stream-chat-angular 4.56.0-perf-message-list.2 → 4.56.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.
- package/assets/version.d.ts +1 -1
- package/bundles/stream-chat-angular.umd.js +125 -95
- package/bundles/stream-chat-angular.umd.js.map +1 -1
- package/esm2015/assets/version.js +2 -2
- package/esm2015/lib/avatar/avatar.component.js +67 -36
- package/esm2015/lib/message-reactions/message-reactions.component.js +29 -11
- package/fesm2015/stream-chat-angular.js +95 -46
- package/fesm2015/stream-chat-angular.js.map +1 -1
- package/lib/avatar/avatar.component.d.ts +14 -5
- package/lib/message-reactions/message-reactions.component.d.ts +11 -5
- package/package.json +1 -1
- package/src/assets/version.ts +1 -1
package/assets/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const version = "4.56.0
|
|
1
|
+
export declare const version = "4.56.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.56.0
|
|
359
|
+
var version = '4.56.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.
|
|
@@ -3116,9 +3116,10 @@
|
|
|
3116
3116
|
* The `Avatar` component displays the provided image, with fallback to the first letter of the optional name input.
|
|
3117
3117
|
*/
|
|
3118
3118
|
var AvatarComponent = /** @class */ (function () {
|
|
3119
|
-
function AvatarComponent(chatClientService, ngZone) {
|
|
3119
|
+
function AvatarComponent(chatClientService, ngZone, cdRef) {
|
|
3120
3120
|
this.chatClientService = chatClientService;
|
|
3121
3121
|
this.ngZone = ngZone;
|
|
3122
|
+
this.cdRef = cdRef;
|
|
3122
3123
|
/**
|
|
3123
3124
|
* The size in pixels of the avatar image.
|
|
3124
3125
|
*/
|
|
@@ -3133,93 +3134,116 @@
|
|
|
3133
3134
|
this.initialsType = 'first-letter-of-first-word';
|
|
3134
3135
|
this.isError = false;
|
|
3135
3136
|
this.isOnline = false;
|
|
3137
|
+
this.initials = '';
|
|
3138
|
+
this.isViewInited = false;
|
|
3139
|
+
this.subscriptions = [];
|
|
3136
3140
|
}
|
|
3137
|
-
AvatarComponent.prototype.
|
|
3141
|
+
AvatarComponent.prototype.ngOnInit = function () {
|
|
3138
3142
|
var _this = this;
|
|
3139
|
-
|
|
3140
|
-
|
|
3141
|
-
|
|
3142
|
-
|
|
3143
|
-
|
|
3144
|
-
|
|
3145
|
-
|
|
3146
|
-
.pipe(operators.filter(function (e) { return e.eventType === 'user.presence.changed'; }))
|
|
3147
|
-
.subscribe(function (event) {
|
|
3148
|
-
var _a;
|
|
3149
|
-
if (((_a = event.event.user) === null || _a === void 0 ? void 0 : _a.id) === otherMember_1.id) {
|
|
3150
|
-
_this.ngZone.run(function () {
|
|
3151
|
-
var _a;
|
|
3152
|
-
_this.isOnline = ((_a = event.event.user) === null || _a === void 0 ? void 0 : _a.online) || false;
|
|
3153
|
-
});
|
|
3154
|
-
}
|
|
3155
|
-
});
|
|
3143
|
+
this.subscriptions.push(this.chatClientService.user$.subscribe(function (u) {
|
|
3144
|
+
if ((u === null || u === void 0 ? void 0 : u.id) !== _this.userId) {
|
|
3145
|
+
_this.userId = u === null || u === void 0 ? void 0 : u.id;
|
|
3146
|
+
if (_this.type || _this.channel || _this.name) {
|
|
3147
|
+
_this.setInitials();
|
|
3148
|
+
_this.setFallbackChannelImage();
|
|
3149
|
+
_this.updateIsOnlineSubscription();
|
|
3156
3150
|
}
|
|
3157
|
-
|
|
3158
|
-
|
|
3151
|
+
if (_this.isViewInited) {
|
|
3152
|
+
_this.cdRef.detectChanges();
|
|
3159
3153
|
}
|
|
3160
3154
|
}
|
|
3161
|
-
|
|
3162
|
-
|
|
3163
|
-
|
|
3164
|
-
|
|
3155
|
+
}));
|
|
3156
|
+
};
|
|
3157
|
+
AvatarComponent.prototype.ngOnChanges = function (changes) {
|
|
3158
|
+
if (changes['channel']) {
|
|
3159
|
+
this.updateIsOnlineSubscription();
|
|
3160
|
+
}
|
|
3161
|
+
if (changes.type || changes.name || changes.channel) {
|
|
3162
|
+
this.setInitials();
|
|
3163
|
+
}
|
|
3164
|
+
if (changes.type || changes.channel) {
|
|
3165
|
+
this.setFallbackChannelImage();
|
|
3165
3166
|
}
|
|
3166
3167
|
};
|
|
3167
|
-
|
|
3168
|
-
|
|
3169
|
-
|
|
3170
|
-
|
|
3171
|
-
|
|
3172
|
-
|
|
3173
|
-
|
|
3174
|
-
|
|
3175
|
-
if ((_c = (_b = this.channel) === null || _b === void 0 ? void 0 : _b.data) === null || _c === void 0 ? void 0 : _c.name) {
|
|
3176
|
-
result = (_e = (_d = this.channel) === null || _d === void 0 ? void 0 : _d.data) === null || _e === void 0 ? void 0 : _e.name;
|
|
3177
|
-
}
|
|
3178
|
-
else {
|
|
3179
|
-
var otherMember = this.getOtherMemberIfOneToOneChannel();
|
|
3180
|
-
if (otherMember) {
|
|
3181
|
-
result = otherMember.name || otherMember.id || '';
|
|
3182
|
-
}
|
|
3183
|
-
else {
|
|
3184
|
-
result = '#';
|
|
3185
|
-
}
|
|
3186
|
-
}
|
|
3187
|
-
}
|
|
3188
|
-
var words = result.split(' ');
|
|
3189
|
-
var initials;
|
|
3190
|
-
if (this.initialsType === 'first-letter-of-each-word') {
|
|
3191
|
-
initials = words.map(function (w) { return w.charAt(0) || ''; }).join('');
|
|
3168
|
+
AvatarComponent.prototype.setFallbackChannelImage = function () {
|
|
3169
|
+
if (this.type !== 'channel') {
|
|
3170
|
+
this.fallbackChannelImage = undefined;
|
|
3171
|
+
}
|
|
3172
|
+
else {
|
|
3173
|
+
var otherMember = this.getOtherMemberIfOneToOneChannel();
|
|
3174
|
+
if (otherMember) {
|
|
3175
|
+
this.fallbackChannelImage = otherMember.image;
|
|
3192
3176
|
}
|
|
3193
3177
|
else {
|
|
3194
|
-
|
|
3178
|
+
this.fallbackChannelImage = undefined;
|
|
3195
3179
|
}
|
|
3196
|
-
|
|
3197
|
-
|
|
3198
|
-
|
|
3199
|
-
|
|
3200
|
-
|
|
3201
|
-
|
|
3202
|
-
|
|
3203
|
-
|
|
3204
|
-
|
|
3180
|
+
}
|
|
3181
|
+
};
|
|
3182
|
+
AvatarComponent.prototype.setInitials = function () {
|
|
3183
|
+
var _a, _b, _c, _d, _e;
|
|
3184
|
+
var result = '';
|
|
3185
|
+
if (this.type === 'user') {
|
|
3186
|
+
result = ((_a = this.name) === null || _a === void 0 ? void 0 : _a.toString()) || '';
|
|
3187
|
+
}
|
|
3188
|
+
else if (this.type === 'channel') {
|
|
3189
|
+
if ((_c = (_b = this.channel) === null || _b === void 0 ? void 0 : _b.data) === null || _c === void 0 ? void 0 : _c.name) {
|
|
3190
|
+
result = (_e = (_d = this.channel) === null || _d === void 0 ? void 0 : _d.data) === null || _e === void 0 ? void 0 : _e.name;
|
|
3205
3191
|
}
|
|
3206
3192
|
else {
|
|
3207
3193
|
var otherMember = this.getOtherMemberIfOneToOneChannel();
|
|
3208
3194
|
if (otherMember) {
|
|
3209
|
-
|
|
3195
|
+
result = otherMember.name || otherMember.id || '';
|
|
3210
3196
|
}
|
|
3211
3197
|
else {
|
|
3212
|
-
|
|
3198
|
+
result = '#';
|
|
3213
3199
|
}
|
|
3214
3200
|
}
|
|
3215
|
-
}
|
|
3216
|
-
|
|
3217
|
-
|
|
3218
|
-
|
|
3201
|
+
}
|
|
3202
|
+
var words = result.split(' ');
|
|
3203
|
+
var initials;
|
|
3204
|
+
if (this.initialsType === 'first-letter-of-each-word') {
|
|
3205
|
+
initials = words.map(function (w) { return w.charAt(0) || ''; }).join('');
|
|
3206
|
+
}
|
|
3207
|
+
else {
|
|
3208
|
+
initials = words[0].charAt(0) || '';
|
|
3209
|
+
}
|
|
3210
|
+
this.initials = initials;
|
|
3211
|
+
};
|
|
3212
|
+
AvatarComponent.prototype.updateIsOnlineSubscription = function () {
|
|
3213
|
+
var _this = this;
|
|
3214
|
+
var _a, _b;
|
|
3215
|
+
if (this.channel) {
|
|
3216
|
+
var otherMember_1 = this.getOtherMemberIfOneToOneChannel();
|
|
3217
|
+
if (otherMember_1) {
|
|
3218
|
+
this.isOnline = otherMember_1.online || false;
|
|
3219
|
+
this.isOnlineSubscription = this.chatClientService.events$
|
|
3220
|
+
.pipe(operators.filter(function (e) { return e.eventType === 'user.presence.changed'; }))
|
|
3221
|
+
.subscribe(function (event) {
|
|
3222
|
+
var _a;
|
|
3223
|
+
if (((_a = event.event.user) === null || _a === void 0 ? void 0 : _a.id) === otherMember_1.id) {
|
|
3224
|
+
_this.ngZone.run(function () {
|
|
3225
|
+
var _a;
|
|
3226
|
+
_this.isOnline = ((_a = event.event.user) === null || _a === void 0 ? void 0 : _a.online) || false;
|
|
3227
|
+
});
|
|
3228
|
+
}
|
|
3229
|
+
});
|
|
3230
|
+
}
|
|
3231
|
+
else {
|
|
3232
|
+
(_a = this.isOnlineSubscription) === null || _a === void 0 ? void 0 : _a.unsubscribe();
|
|
3233
|
+
}
|
|
3234
|
+
}
|
|
3235
|
+
else {
|
|
3236
|
+
this.isOnline = false;
|
|
3237
|
+
(_b = this.isOnlineSubscription) === null || _b === void 0 ? void 0 : _b.unsubscribe();
|
|
3238
|
+
}
|
|
3239
|
+
};
|
|
3240
|
+
AvatarComponent.prototype.ngAfterViewInit = function () {
|
|
3241
|
+
this.isViewInited = true;
|
|
3242
|
+
};
|
|
3219
3243
|
AvatarComponent.prototype.getOtherMemberIfOneToOneChannel = function () {
|
|
3220
3244
|
var _this = this;
|
|
3221
3245
|
var _a, _b;
|
|
3222
|
-
var otherMembers = Object.values(((_b = (_a = this.channel) === null || _a === void 0 ? void 0 : _a.state) === null || _b === void 0 ? void 0 : _b.members) || {}).filter(function (m) {
|
|
3246
|
+
var otherMembers = Object.values(((_b = (_a = this.channel) === null || _a === void 0 ? void 0 : _a.state) === null || _b === void 0 ? void 0 : _b.members) || {}).filter(function (m) { return m.user_id !== _this.userId; });
|
|
3223
3247
|
if (otherMembers.length === 1) {
|
|
3224
3248
|
return otherMembers[0].user;
|
|
3225
3249
|
}
|
|
@@ -3229,7 +3253,7 @@
|
|
|
3229
3253
|
};
|
|
3230
3254
|
return AvatarComponent;
|
|
3231
3255
|
}());
|
|
3232
|
-
AvatarComponent.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.5", ngImport: i0__namespace, type: AvatarComponent, deps: [{ token: ChatClientService }, { token: i0__namespace.NgZone }], target: i0__namespace.ɵɵFactoryTarget.Component });
|
|
3256
|
+
AvatarComponent.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.5", ngImport: i0__namespace, type: AvatarComponent, deps: [{ token: ChatClientService }, { token: i0__namespace.NgZone }, { token: i0__namespace.ChangeDetectorRef }], target: i0__namespace.ɵɵFactoryTarget.Component });
|
|
3233
3257
|
AvatarComponent.ɵcmp = i0__namespace.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.5", type: AvatarComponent, selector: "stream-avatar", inputs: { name: "name", imageUrl: "imageUrl", size: "size", location: "location", channel: "channel", user: "user", type: "type", showOnlineIndicator: "showOnlineIndicator", initialsType: "initialsType" }, usesOnChanges: true, ngImport: i0__namespace, template: "<div\n class=\"str-chat__avatar str-chat__avatar--circle stream-chat__avatar--{{\n location\n }}\"\n title=\"{{ name }}\"\n [style]=\"{\n flexBasis: 'calc(var(--str-chat__spacing-px, 1px) * ' + size + ')',\n fontSize:\n initialsType === 'first-letter-of-first-word'\n ? 'calc(var(--str-chat__spacing-px, 1px) * ' + size / 2 + ')'\n : 'calc(var(--str-chat__spacing-px, 1px) * ' + size / 3 + ')',\n height: 'calc(var(--str-chat__spacing-px, 1px) * ' + size + ')',\n lineHeight: 'calc(var(--str-chat__spacing-px, 1px) * ' + size + ')',\n width: 'calc(var(--str-chat__spacing-px, 1px) * ' + size + ')'\n }\"\n>\n <img\n *ngIf=\"(imageUrl || fallbackChannelImage) && !isError; else fallback\"\n class=\"str-chat__avatar-image str-chat__avatar-image\"\n src=\"{{ imageUrl || fallbackChannelImage }}\"\n alt=\"{{ initials }}\"\n data-testid=\"avatar-img\"\n (error)=\"isError = true\"\n [style]=\"{\n flexBasis: 'calc(var(--str-chat__spacing-px, 1px) * ' + size + ')',\n height: 'calc(var(--str-chat__spacing-px, 1px) * ' + size + ')',\n objectFit: 'cover',\n width: 'calc(var(--str-chat__spacing-px, 1px) * ' + size + ')'\n }\"\n fetchpriority=\"high\"\n />\n <ng-template #fallback>\n <div\n data-testid=\"fallback-img\"\n style=\"overflow: hidden; white-space: nowrap; text-overflow: ellipsis\"\n class=\"str-chat__avatar-fallback\"\n >\n {{ initials }}\n </div>\n </ng-template>\n <div\n data-testid=\"online-indicator\"\n *ngIf=\"isOnline && showOnlineIndicator\"\n class=\"str-chat__avatar--online-indicator\"\n ></div>\n</div>\n", styles: [""], directives: [{ type: i9__namespace.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }] });
|
|
3234
3258
|
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.5", ngImport: i0__namespace, type: AvatarComponent, decorators: [{
|
|
3235
3259
|
type: i0.Component,
|
|
@@ -3238,7 +3262,7 @@
|
|
|
3238
3262
|
templateUrl: './avatar.component.html',
|
|
3239
3263
|
styleUrls: ['./avatar.component.scss'],
|
|
3240
3264
|
}]
|
|
3241
|
-
}], ctorParameters: function () { return [{ type: ChatClientService }, { type: i0__namespace.NgZone }]; }, propDecorators: { name: [{
|
|
3265
|
+
}], ctorParameters: function () { return [{ type: ChatClientService }, { type: i0__namespace.NgZone }, { type: i0__namespace.ChangeDetectorRef }]; }, propDecorators: { name: [{
|
|
3242
3266
|
type: i0.Input
|
|
3243
3267
|
}], imageUrl: [{
|
|
3244
3268
|
type: i0.Input
|
|
@@ -5544,6 +5568,11 @@
|
|
|
5544
5568
|
this.isLoading = true;
|
|
5545
5569
|
this.reactions = [];
|
|
5546
5570
|
this.shouldHandleReactionClick = true;
|
|
5571
|
+
this.existingReactions = [];
|
|
5572
|
+
this.reactionsCount = 0;
|
|
5573
|
+
this.reactionOptions = [];
|
|
5574
|
+
this.subscriptions = [];
|
|
5575
|
+
this.isViewInited = false;
|
|
5547
5576
|
this.isOpenChange = function (isOpen) {
|
|
5548
5577
|
_this.selectedReactionType = isOpen ? _this.selectedReactionType : undefined;
|
|
5549
5578
|
};
|
|
@@ -5554,6 +5583,16 @@
|
|
|
5554
5583
|
}
|
|
5555
5584
|
};
|
|
5556
5585
|
}
|
|
5586
|
+
MessageReactionsComponent.prototype.ngOnInit = function () {
|
|
5587
|
+
var _this = this;
|
|
5588
|
+
this.subscriptions.push(this.messageReactionsService.reactions$.subscribe(function (reactions) {
|
|
5589
|
+
_this.reactionOptions = Object.keys(reactions);
|
|
5590
|
+
_this.setExistingReactions();
|
|
5591
|
+
if (_this.isViewInited) {
|
|
5592
|
+
_this.cdRef.detectChanges();
|
|
5593
|
+
}
|
|
5594
|
+
}));
|
|
5595
|
+
};
|
|
5557
5596
|
MessageReactionsComponent.prototype.ngOnChanges = function (changes) {
|
|
5558
5597
|
var _this = this;
|
|
5559
5598
|
if (changes.isSelectorOpen) {
|
|
@@ -5561,6 +5600,9 @@
|
|
|
5561
5600
|
? setTimeout(function () { return _this.watchForOutsideClicks(); }) // setTimeout: wait for current click to bubble up, and only watch for clicks after that
|
|
5562
5601
|
: this.stopWatchForOutsideClicks();
|
|
5563
5602
|
}
|
|
5603
|
+
if (changes.messageReactionCounts) {
|
|
5604
|
+
this.setExistingReactions();
|
|
5605
|
+
}
|
|
5564
5606
|
if (changes.messageReactionCounts && this.messageReactionCounts) {
|
|
5565
5607
|
var reactionsCount = Object.keys(this.messageReactionCounts).reduce(function (acc, key) { return acc + (_this.messageReactionCounts[key] || 0); }, 0);
|
|
5566
5608
|
this.shouldHandleReactionClick =
|
|
@@ -5568,37 +5610,18 @@
|
|
|
5568
5610
|
!!this.messageReactionsService.customReactionClickHandler;
|
|
5569
5611
|
}
|
|
5570
5612
|
};
|
|
5613
|
+
MessageReactionsComponent.prototype.ngAfterViewInit = function () {
|
|
5614
|
+
this.isViewInited = true;
|
|
5615
|
+
};
|
|
5571
5616
|
MessageReactionsComponent.prototype.ngAfterViewChecked = function () {
|
|
5572
5617
|
if (this.tooltipText && !this.tooltipPositions) {
|
|
5573
5618
|
this.setTooltipPosition();
|
|
5574
5619
|
this.cdRef.detectChanges();
|
|
5575
5620
|
}
|
|
5576
5621
|
};
|
|
5577
|
-
|
|
5578
|
-
|
|
5579
|
-
|
|
5580
|
-
return Object.keys(this.messageReactionCounts)
|
|
5581
|
-
.filter(function (k) { return _this.reactionOptions.indexOf(k) !== -1; })
|
|
5582
|
-
.filter(function (k) { return _this.messageReactionCounts[k] > 0; });
|
|
5583
|
-
},
|
|
5584
|
-
enumerable: false,
|
|
5585
|
-
configurable: true
|
|
5586
|
-
});
|
|
5587
|
-
Object.defineProperty(MessageReactionsComponent.prototype, "reactionsCount", {
|
|
5588
|
-
get: function () {
|
|
5589
|
-
var _this = this;
|
|
5590
|
-
return this.existingReactions.reduce(function (total, reaction) { return total + _this.messageReactionCounts[reaction]; }, 0);
|
|
5591
|
-
},
|
|
5592
|
-
enumerable: false,
|
|
5593
|
-
configurable: true
|
|
5594
|
-
});
|
|
5595
|
-
Object.defineProperty(MessageReactionsComponent.prototype, "reactionOptions", {
|
|
5596
|
-
get: function () {
|
|
5597
|
-
return Object.keys(this.messageReactionsService.reactions);
|
|
5598
|
-
},
|
|
5599
|
-
enumerable: false,
|
|
5600
|
-
configurable: true
|
|
5601
|
-
});
|
|
5622
|
+
MessageReactionsComponent.prototype.ngOnDestroy = function () {
|
|
5623
|
+
this.subscriptions.forEach(function (s) { return s.unsubscribe(); });
|
|
5624
|
+
};
|
|
5602
5625
|
MessageReactionsComponent.prototype.getLatestUserByReaction = function (reactionType) {
|
|
5603
5626
|
var _a;
|
|
5604
5627
|
return (_a = this.latestReactions.find(function (r) { return r.type === reactionType && r.user; })) === null || _a === void 0 ? void 0 : _a.user;
|
|
@@ -5740,6 +5763,13 @@
|
|
|
5740
5763
|
});
|
|
5741
5764
|
});
|
|
5742
5765
|
};
|
|
5766
|
+
MessageReactionsComponent.prototype.setExistingReactions = function () {
|
|
5767
|
+
var _this = this;
|
|
5768
|
+
this.existingReactions = Object.keys(this.messageReactionCounts)
|
|
5769
|
+
.filter(function (k) { return _this.reactionOptions.indexOf(k) !== -1; })
|
|
5770
|
+
.filter(function (k) { return _this.messageReactionCounts[k] > 0; });
|
|
5771
|
+
this.reactionsCount = this.existingReactions.reduce(function (total, reaction) { return total + _this.messageReactionCounts[reaction]; }, 0);
|
|
5772
|
+
};
|
|
5743
5773
|
return MessageReactionsComponent;
|
|
5744
5774
|
}());
|
|
5745
5775
|
MessageReactionsComponent.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.5", ngImport: i0__namespace, type: MessageReactionsComponent, deps: [{ token: i0__namespace.ChangeDetectorRef }, { token: ChannelService }, { token: MessageReactionsService }, { token: CustomTemplatesService }, { token: ThemeService }], target: i0__namespace.ɵɵFactoryTarget.Component });
|