stream-chat-angular 4.67.0 → 4.68.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 +101 -9
- package/bundles/stream-chat-angular.umd.js.map +1 -1
- package/esm2015/assets/version.js +2 -2
- package/esm2015/lib/channel.service.js +29 -2
- package/esm2015/lib/message-list/message-list.component.js +75 -9
- package/fesm2015/stream-chat-angular.js +101 -10
- package/fesm2015/stream-chat-angular.js.map +1 -1
- package/lib/channel.service.d.ts +13 -1
- package/lib/message-list/message-list.component.d.ts +9 -1
- 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.
|
|
1
|
+
export declare const version = "4.68.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.
|
|
359
|
+
var version = '4.68.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.
|
|
@@ -838,6 +838,23 @@
|
|
|
838
838
|
.asObservable()
|
|
839
839
|
.pipe(operators.shareReplay(1));
|
|
840
840
|
}
|
|
841
|
+
/**
|
|
842
|
+
* internal
|
|
843
|
+
*/
|
|
844
|
+
ChannelService.prototype.removeOldMessageFromMessageList = function () {
|
|
845
|
+
var channel = this.activeChannelSubject.getValue();
|
|
846
|
+
var channelMessages = channel === null || channel === void 0 ? void 0 : channel.state.latestMessages;
|
|
847
|
+
var targetLength = Math.ceil(ChannelService.MAX_MESSAGE_COUNT_IN_MESSAGE_LIST / 2);
|
|
848
|
+
if (!channel ||
|
|
849
|
+
!channelMessages ||
|
|
850
|
+
channelMessages !== (channel === null || channel === void 0 ? void 0 : channel.state.latestMessages) ||
|
|
851
|
+
channelMessages.length <= targetLength) {
|
|
852
|
+
return;
|
|
853
|
+
}
|
|
854
|
+
var messages = channelMessages;
|
|
855
|
+
messages.splice(0, messages.length - targetLength);
|
|
856
|
+
this.activeChannelMessagesSubject.next(messages);
|
|
857
|
+
};
|
|
841
858
|
Object.defineProperty(ChannelService.prototype, "shouldMarkActiveChannelAsRead", {
|
|
842
859
|
/**
|
|
843
860
|
* If set to false, read events won't be sent as new messages are received. If set to true active channel (if any) will immediately be marked as read.
|
|
@@ -1557,6 +1574,12 @@
|
|
|
1557
1574
|
});
|
|
1558
1575
|
});
|
|
1559
1576
|
};
|
|
1577
|
+
/**
|
|
1578
|
+
* Clears the currently selected message to jump
|
|
1579
|
+
*/
|
|
1580
|
+
ChannelService.prototype.clearMessageJump = function () {
|
|
1581
|
+
this.jumpToMessageSubject.next({ id: undefined, parentId: undefined });
|
|
1582
|
+
};
|
|
1560
1583
|
/**
|
|
1561
1584
|
* Pins the given message in the channel
|
|
1562
1585
|
* @param message
|
|
@@ -2458,7 +2481,11 @@
|
|
|
2458
2481
|
return ChannelService;
|
|
2459
2482
|
}());
|
|
2460
2483
|
/**
|
|
2461
|
-
* internal
|
|
2484
|
+
* @internal
|
|
2485
|
+
*/
|
|
2486
|
+
ChannelService.MAX_MESSAGE_COUNT_IN_MESSAGE_LIST = 250;
|
|
2487
|
+
/**
|
|
2488
|
+
* @internal
|
|
2462
2489
|
*/
|
|
2463
2490
|
ChannelService.MAX_MESSAGE_REACTIONS_TO_FETCH = 1200;
|
|
2464
2491
|
ChannelService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.5", ngImport: i0__namespace, type: ChannelService, deps: [{ token: ChatClientService }, { token: i0__namespace.NgZone }, { token: NotificationService }], target: i0__namespace.ɵɵFactoryTarget.Injectable });
|
|
@@ -7426,6 +7453,10 @@
|
|
|
7426
7453
|
* You can turn on and off the loading indicator that signals to users that more messages are being loaded to the message list
|
|
7427
7454
|
*/
|
|
7428
7455
|
this.displayLoadingIndicator = true;
|
|
7456
|
+
/**
|
|
7457
|
+
* @internal
|
|
7458
|
+
*/
|
|
7459
|
+
this.limitNumberOfMessagesInList = true;
|
|
7429
7460
|
this.emptyMainMessageListTemplate = null;
|
|
7430
7461
|
this.emptyThreadMessageListTemplate = null;
|
|
7431
7462
|
this.enabledMessageActions = [];
|
|
@@ -7441,6 +7472,8 @@
|
|
|
7441
7472
|
this.isLatestMessageInList = true;
|
|
7442
7473
|
this.parsedDates = new Map();
|
|
7443
7474
|
this.isViewInited = false;
|
|
7475
|
+
this.isSafari = /^((?!chrome|android).)*safari/i.test(navigator.userAgent);
|
|
7476
|
+
this.forceRepaintSubject = new rxjs.Subject();
|
|
7444
7477
|
this.messageNotificationJumpClicked = function () {
|
|
7445
7478
|
_this.jumpToFirstUnreadMessage();
|
|
7446
7479
|
_this.isUnreadNotificationVisible = false;
|
|
@@ -7460,6 +7493,9 @@
|
|
|
7460
7493
|
});
|
|
7461
7494
|
MessageListComponent.prototype.ngOnInit = function () {
|
|
7462
7495
|
var _this = this;
|
|
7496
|
+
this.subscriptions.push(this.forceRepaintSubject.pipe(operators.throttleTime(1000)).subscribe(function () {
|
|
7497
|
+
_this.forceRepaint();
|
|
7498
|
+
}));
|
|
7463
7499
|
this.subscriptions.push(this.channelService.activeChannel$.subscribe(function (channel) {
|
|
7464
7500
|
var _a, _b, _c, _d, _e, _f, _g;
|
|
7465
7501
|
(_b = (_a = _this.chatClientService.chatClient) === null || _a === void 0 ? void 0 : _a.logger) === null || _b === void 0 ? void 0 : _b.call(_a, 'info', ((channel === null || channel === void 0 ? void 0 : channel.cid) || 'undefined') + " selected", { tags: "message list " + _this.mode });
|
|
@@ -7472,6 +7508,9 @@
|
|
|
7472
7508
|
_this.isUnreadNotificationVisible = false;
|
|
7473
7509
|
(_e = (_d = (_c = _this.chatClientService) === null || _c === void 0 ? void 0 : _c.chatClient) === null || _d === void 0 ? void 0 : _d.logger) === null || _e === void 0 ? void 0 : _e.call(_d, 'info', "new channel is different from prev channel, reseting scroll state", { tags: "message list " + _this.mode });
|
|
7474
7510
|
_this.parsedDates = new Map();
|
|
7511
|
+
if (_this.messageRemoveTimeout) {
|
|
7512
|
+
clearTimeout(_this.messageRemoveTimeout);
|
|
7513
|
+
}
|
|
7475
7514
|
_this.resetScrollState();
|
|
7476
7515
|
_this.channelId = channel === null || channel === void 0 ? void 0 : channel.id;
|
|
7477
7516
|
if (_this.isViewInited) {
|
|
@@ -7619,6 +7658,9 @@
|
|
|
7619
7658
|
.subscribe(function (config) {
|
|
7620
7659
|
var _a, _b;
|
|
7621
7660
|
var messageId = undefined;
|
|
7661
|
+
if (_this.messageRemoveTimeout) {
|
|
7662
|
+
clearTimeout(_this.messageRemoveTimeout);
|
|
7663
|
+
}
|
|
7622
7664
|
if (_this.mode === 'main') {
|
|
7623
7665
|
messageId = config.parentId || config.id;
|
|
7624
7666
|
}
|
|
@@ -7645,6 +7687,7 @@
|
|
|
7645
7687
|
}
|
|
7646
7688
|
}
|
|
7647
7689
|
}
|
|
7690
|
+
_this.channelService.clearMessageJump();
|
|
7648
7691
|
}));
|
|
7649
7692
|
this.subscriptions.push(this.customTemplatesService.emptyMainMessageListPlaceholder$.subscribe(function (template) {
|
|
7650
7693
|
var isChanged = _this.emptyMainMessageListTemplate !== template;
|
|
@@ -7729,7 +7772,7 @@
|
|
|
7729
7772
|
}
|
|
7730
7773
|
};
|
|
7731
7774
|
MessageListComponent.prototype.ngOnDestroy = function () {
|
|
7732
|
-
var _a;
|
|
7775
|
+
var _a, _b;
|
|
7733
7776
|
this.subscriptions.forEach(function (s) { return s.unsubscribe(); });
|
|
7734
7777
|
(_a = this.newMessageSubscription) === null || _a === void 0 ? void 0 : _a.unsubscribe();
|
|
7735
7778
|
if (this.scrollEndTimeout) {
|
|
@@ -7741,6 +7784,10 @@
|
|
|
7741
7784
|
if (this.jumpToLatestButtonVisibilityTimeout) {
|
|
7742
7785
|
clearTimeout(this.jumpToLatestButtonVisibilityTimeout);
|
|
7743
7786
|
}
|
|
7787
|
+
if (this.messageRemoveTimeout) {
|
|
7788
|
+
clearTimeout(this.messageRemoveTimeout);
|
|
7789
|
+
}
|
|
7790
|
+
(_b = this.removeOldMessagesSubscription) === null || _b === void 0 ? void 0 : _b.unsubscribe();
|
|
7744
7791
|
};
|
|
7745
7792
|
MessageListComponent.prototype.trackByMessageId = function (index, item) {
|
|
7746
7793
|
return item.id;
|
|
@@ -7755,7 +7802,9 @@
|
|
|
7755
7802
|
MessageListComponent.prototype.scrollToBottom = function () {
|
|
7756
7803
|
this.scrollContainer.nativeElement.scrollTop =
|
|
7757
7804
|
this.scrollContainer.nativeElement.scrollHeight + 0.1;
|
|
7758
|
-
this.
|
|
7805
|
+
if (this.isSafari) {
|
|
7806
|
+
this.forceRepaintSubject.next();
|
|
7807
|
+
}
|
|
7759
7808
|
};
|
|
7760
7809
|
MessageListComponent.prototype.scrollToTop = function () {
|
|
7761
7810
|
this.scrollContainer.nativeElement.scrollTop = 0;
|
|
@@ -7799,7 +7848,7 @@
|
|
|
7799
7848
|
}
|
|
7800
7849
|
if (this.shouldLoadMoreMessages(scrollPosition)) {
|
|
7801
7850
|
this.ngZone.run(function () {
|
|
7802
|
-
var _a, _b;
|
|
7851
|
+
var _a, _b, _c;
|
|
7803
7852
|
_this.containerHeight = _this.scrollContainer.nativeElement.scrollHeight;
|
|
7804
7853
|
var direction;
|
|
7805
7854
|
if (_this.direction === 'top-to-bottom') {
|
|
@@ -7814,6 +7863,9 @@
|
|
|
7814
7863
|
if (result) {
|
|
7815
7864
|
(_b = (_a = _this.chatClientService.chatClient) === null || _a === void 0 ? void 0 : _a.logger) === null || _b === void 0 ? void 0 : _b.call(_a, 'info', "Displaying loading indicator", { tags: "message list " + _this.mode });
|
|
7816
7865
|
_this.isLoading = true;
|
|
7866
|
+
(_c = result.catch) === null || _c === void 0 ? void 0 : _c.call(result, function () {
|
|
7867
|
+
_this.isLoading = false;
|
|
7868
|
+
});
|
|
7817
7869
|
}
|
|
7818
7870
|
_this.cdRef.detectChanges();
|
|
7819
7871
|
});
|
|
@@ -7890,17 +7942,21 @@
|
|
|
7890
7942
|
position = 'top';
|
|
7891
7943
|
}
|
|
7892
7944
|
else if (Math.ceil(this.scrollContainer.nativeElement.scrollTop) +
|
|
7893
|
-
this.scrollContainer.nativeElement.clientHeight
|
|
7945
|
+
this.scrollContainer.nativeElement.clientHeight +
|
|
7946
|
+
1 >=
|
|
7894
7947
|
this.scrollContainer.nativeElement.scrollHeight) {
|
|
7895
7948
|
position = 'bottom';
|
|
7896
7949
|
}
|
|
7897
7950
|
return position;
|
|
7898
7951
|
};
|
|
7899
7952
|
MessageListComponent.prototype.shouldLoadMoreMessages = function (scrollPosition) {
|
|
7900
|
-
return scrollPosition !== 'middle' &&
|
|
7953
|
+
return (scrollPosition !== 'middle' &&
|
|
7954
|
+
!this.highlightedMessageId &&
|
|
7955
|
+
!this.isLoading);
|
|
7901
7956
|
};
|
|
7902
7957
|
MessageListComponent.prototype.setMessages$ = function () {
|
|
7903
7958
|
var _this = this;
|
|
7959
|
+
var _a;
|
|
7904
7960
|
this.messages$ = (this.mode === 'main'
|
|
7905
7961
|
? this.channelService.activeChannelMessages$
|
|
7906
7962
|
: this.channelService.activeThreadMessages$).pipe(operators.tap(function (messages) {
|
|
@@ -7963,7 +8019,41 @@
|
|
|
7963
8019
|
lastReadMessageId: _this.lastReadMessageId,
|
|
7964
8020
|
}); });
|
|
7965
8021
|
_this.isNextMessageOnSeparateDate = messages.map(function (m, i) { return _this.checkIfOnSeparateDates(m, messages[i + 1]); });
|
|
7966
|
-
}));
|
|
8022
|
+
}), operators.shareReplay(1));
|
|
8023
|
+
(_a = this.removeOldMessagesSubscription) === null || _a === void 0 ? void 0 : _a.unsubscribe();
|
|
8024
|
+
this.removeOldMessagesSubscription = rxjs.combineLatest([
|
|
8025
|
+
this.channelService.jumpToMessage$,
|
|
8026
|
+
this.messages$,
|
|
8027
|
+
]).subscribe(function (_k) {
|
|
8028
|
+
var _l = __read(_k, 2), jumpToMessage = _l[0], messages = _l[1];
|
|
8029
|
+
if (_this.limitNumberOfMessagesInList &&
|
|
8030
|
+
_this.mode === 'main' &&
|
|
8031
|
+
messages.length >
|
|
8032
|
+
ChannelService.MAX_MESSAGE_COUNT_IN_MESSAGE_LIST * 0.5 &&
|
|
8033
|
+
!_this.isUserScrolled &&
|
|
8034
|
+
!(jumpToMessage === null || jumpToMessage === void 0 ? void 0 : jumpToMessage.id) &&
|
|
8035
|
+
_this.isLatestMessageInList) {
|
|
8036
|
+
if (_this.messageRemoveTimeout) {
|
|
8037
|
+
clearTimeout(_this.messageRemoveTimeout);
|
|
8038
|
+
}
|
|
8039
|
+
if (messages.length >= ChannelService.MAX_MESSAGE_COUNT_IN_MESSAGE_LIST) {
|
|
8040
|
+
_this.channelService.removeOldMessageFromMessageList();
|
|
8041
|
+
}
|
|
8042
|
+
else {
|
|
8043
|
+
_this.messageRemoveTimeout = setTimeout(function () {
|
|
8044
|
+
if (_this.limitNumberOfMessagesInList &&
|
|
8045
|
+
_this.mode === 'main' &&
|
|
8046
|
+
messages.length >
|
|
8047
|
+
ChannelService.MAX_MESSAGE_COUNT_IN_MESSAGE_LIST * 0.5 &&
|
|
8048
|
+
!_this.isUserScrolled &&
|
|
8049
|
+
!_this.highlightedMessageId &&
|
|
8050
|
+
_this.isLatestMessageInList) {
|
|
8051
|
+
_this.channelService.removeOldMessageFromMessageList();
|
|
8052
|
+
}
|
|
8053
|
+
}, 1500);
|
|
8054
|
+
}
|
|
8055
|
+
}
|
|
8056
|
+
});
|
|
7967
8057
|
};
|
|
7968
8058
|
MessageListComponent.prototype.resetScrollState = function () {
|
|
7969
8059
|
this.isEmpty = true;
|
|
@@ -8055,7 +8145,7 @@
|
|
|
8055
8145
|
return MessageListComponent;
|
|
8056
8146
|
}());
|
|
8057
8147
|
MessageListComponent.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.5", ngImport: i0__namespace, type: MessageListComponent, deps: [{ token: ChannelService }, { token: ChatClientService }, { token: CustomTemplatesService }, { token: DateParserService }, { token: i0__namespace.NgZone }, { token: i0__namespace.ChangeDetectorRef }, { token: MessageActionsService }], target: i0__namespace.ɵɵFactoryTarget.Component });
|
|
8058
|
-
MessageListComponent.ɵcmp = i0__namespace.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.5", type: MessageListComponent, selector: "stream-message-list", inputs: { mode: "mode", direction: "direction", messageOptionsTrigger: "messageOptionsTrigger", hideJumpToLatestButtonDuringScroll: "hideJumpToLatestButtonDuringScroll", customMessageActions: "customMessageActions", displayDateSeparator: "displayDateSeparator", displayUnreadSeparator: "displayUnreadSeparator", dateSeparatorTextPos: "dateSeparatorTextPos", openMessageListAt: "openMessageListAt", hideUnreadCountForNotificationAndIndicator: "hideUnreadCountForNotificationAndIndicator", displayLoadingIndicator: "displayLoadingIndicator" }, host: { properties: { "class": "this.class" } }, viewQueries: [{ propertyName: "scrollContainer", first: true, predicate: ["scrollContainer"], descendants: true }, { propertyName: "parentMessageElement", first: true, predicate: ["parentMessageElement"], descendants: true }], usesOnChanges: true, ngImport: i0__namespace, template: "<ng-container\n *ngIf=\"\n lastReadMessageId &&\n isUnreadNotificationVisible &&\n openMessageListAt === 'last-message' &&\n displayUnreadSeparator\n \"\n>\n <ng-container\n *ngTemplateOutlet=\"\n customnewMessagesNotificationTemplate ||\n defaultUnreadMessagesNotification;\n context: {\n unreadCount: unreadCount,\n onDismiss: messageNotificationDismissClicked,\n onJump: messageNotificationJumpClicked\n }\n \"\n ></ng-container>\n</ng-container>\n<ng-template\n #defaultUnreadMessagesNotification\n let-unreadCount=\"unreadCount\"\n let-onDismiss=\"onDismiss\"\n let-onJump=\"onJump\"\n>\n <div\n class=\"str-chat__unread-messages-notification\"\n data-testid=\"unread-messages-notification\"\n >\n <button\n data-testid=\"unread-messages-notification-jump-to-message\"\n (click)=\"onJump()\"\n >\n <ng-container\n *ngIf=\"\n unreadCount > 0 && !hideUnreadCountForNotificationAndIndicator;\n else noUnreadCount\n \"\n >\n {{\n (unreadCount === 1\n ? \"streamChat.\\{\\{count\\}\\} unread message\"\n : \"streamChat.\\{\\{count\\}\\} unread messages\"\n ) | translate: { count: unreadCount }\n }}\n </ng-container>\n <ng-template #noUnreadCount>\n {{ \"streamChat.Unread messages\" | translate }}\n </ng-template>\n </button>\n <button\n data-testid=\"unread-messages-notification-dismiss\"\n (click)=\"onDismiss()\"\n >\n <stream-icon-placeholder icon=\"close\"></stream-icon-placeholder>\n </button>\n </div>\n</ng-template>\n<div #scrollContainer data-testid=\"scroll-container\" class=\"str-chat__list\">\n <ng-container *ngIf=\"mode === 'main' && isEmpty && emptyListTemplate\">\n <ng-container *ngTemplateOutlet=\"emptyListTemplate\"></ng-container>\n </ng-container>\n <div class=\"str-chat__reverse-infinite-scroll str-chat__message-list-scroll\">\n <ul\n class=\"str-chat__ul\"\n [class.str-chat__message-options-in-bubble]=\"\n messageOptionsTrigger === 'message-bubble'\n \"\n >\n <li\n #parentMessageElement\n *ngIf=\"mode === 'thread' && parentMessage\"\n data-testid=\"parent-message\"\n class=\"str-chat__parent-message-li\"\n >\n <ng-container\n *ngTemplateOutlet=\"\n messageTemplateContainer;\n context: { message: parentMessage, index: 'parent' }\n \"\n ></ng-container>\n <div data-testid=\"reply-count\" class=\"str-chat__thread-start\">\n {{parentMessage?.reply_count === 1 ? ('streamChat.1 reply' | translate) : ('streamChat.{{ replyCount }}\n replies' | translate:replyCountParam)}}\n </div>\n </li>\n <ng-container *ngIf=\"mode === 'thread' && isEmpty && emptyListTemplate\">\n <ng-container *ngTemplateOutlet=\"emptyListTemplate\"></ng-container>\n </ng-container>\n <stream-loading-indicator\n data-testid=\"top-loading-indicator\"\n *ngIf=\"\n isLoading && direction === 'bottom-to-top' && displayLoadingIndicator\n \"\n ></stream-loading-indicator>\n <ng-container *ngIf=\"messages$ | async as messages\">\n <ng-container\n *ngFor=\"\n let message of messages;\n let i = index;\n let isFirst = first;\n let isLast = last;\n trackBy: trackByMessageId\n \"\n >\n <ng-container *ngIf=\"isFirst\">\n <ng-container\n *ngTemplateOutlet=\"\n dateSeparator;\n context: {\n date: message.created_at,\n parsedDate: parseDate(message.created_at)\n }\n \"\n ></ng-container>\n </ng-container>\n <li\n tabindex=\"0\"\n data-testclass=\"message\"\n class=\"str-chat__li str-chat__li--{{ groupStyles[i] }}\"\n id=\"{{ message.id }}\"\n >\n <ng-container\n *ngTemplateOutlet=\"\n messageTemplateContainer;\n context: { message: message, index: i }\n \"\n ></ng-container>\n </li>\n <ng-container\n *ngIf=\"\n (lastReadMessageId === message?.id &&\n direction === 'bottom-to-top') ||\n (direction === 'top-to-bottom' &&\n lastReadMessageId === messages[i + 1]?.id)\n \"\n >\n <li\n *ngIf=\"displayUnreadSeparator\"\n id=\"stream-chat-new-message-indicator\"\n data-testid=\"new-messages-indicator\"\n class=\"str-chat__li str-chat__unread-messages-separator-wrapper\"\n >\n <ng-container\n *ngTemplateOutlet=\"\n customnewMessagesIndicatorTemplate ||\n defaultNewMessagesIndicator;\n context: { unreadCount: unreadCount }\n \"\n ></ng-container>\n </li>\n </ng-container>\n <ng-container *ngIf=\"isNextMessageOnSeparateDate[i]\">\n <ng-container\n *ngTemplateOutlet=\"\n dateSeparator;\n context: {\n date: messages[i + 1].created_at,\n parsedDate: parseDate(messages[i + 1].created_at)\n }\n \"\n ></ng-container>\n </ng-container>\n </ng-container>\n </ng-container>\n <stream-loading-indicator\n data-testid=\"bottom-loading-indicator\"\n *ngIf=\"\n isLoading && direction === 'top-to-bottom' && displayLoadingIndicator\n \"\n ></stream-loading-indicator>\n </ul>\n <ng-template #defaultTypingIndicator let-usersTyping$=\"usersTyping$\">\n <!-- eslint-disable-next-line @angular-eslint/template/no-any -->\n <ng-container *ngIf=\"$any(usersTyping$ | async) as users\">\n <div\n *ngIf=\"users.length > 0\"\n data-testid=\"typing-indicator\"\n class=\"str-chat__typing-indicator str-chat__typing-indicator--typing\"\n >\n <div class=\"str-chat__typing-indicator__dots\">\n <span class=\"str-chat__typing-indicator__dot\"></span>\n <span class=\"str-chat__typing-indicator__dot\"></span>\n <span class=\"str-chat__typing-indicator__dot\"></span>\n </div>\n <div\n data-testid=\"typing-users\"\n class=\"str-chat__typing-indicator__users\"\n >\n {{\n users.length === 1\n ? (\"streamChat.user is typing\"\n | translate: { user: getTypingIndicatorText(users) })\n : (\"streamChat.users are typing\"\n | translate: { users: getTypingIndicatorText(users) })\n }}\n </div>\n </div>\n </ng-container>\n </ng-template>\n <ng-container\n *ngTemplateOutlet=\"\n typingIndicatorTemplate || defaultTypingIndicator;\n context: getTypingIndicatorContext()\n \"\n ></ng-container>\n </div>\n</div>\n<div class=\"str-chat__jump-to-latest-message\">\n <button\n data-testid=\"scroll-to-latest\"\n *ngIf=\"isUserScrolled && isJumpToLatestButtonVisible\"\n class=\"\n str-chat__message-notification-scroll-to-latest\n str-chat__message-notification-scroll-to-latest-right\n str-chat__circle-fab\n \"\n (keyup.enter)=\"jumpToLatestMessage()\"\n (click)=\"jumpToLatestMessage()\"\n >\n <stream-icon\n class=\"str-chat__jump-to-latest-icon str-chat__circle-fab-icon\"\n [icon]=\"direction === 'bottom-to-top' ? 'arrow-down' : 'arrow-up'\"\n ></stream-icon>\n <div\n *ngIf=\"newMessageCountWhileBeingScrolled > 0\"\n class=\"\n str-chat__message-notification\n str-chat__message-notification-scroll-to-latest-unread-count\n str-chat__jump-to-latest-unread-count\n \"\n >\n {{ newMessageCountWhileBeingScrolled }}\n </div>\n </button>\n</div>\n\n<ng-template #messageTemplateContainer let-message=\"message\" let-index=\"index\">\n <ng-template\n #defaultMessageTemplate\n let-messageInput=\"message\"\n let-isLastSentMessage=\"isLastSentMessage\"\n let-enabledMessageActions=\"enabledMessageActions\"\n let-mode=\"mode\"\n let-isHighlighted=\"isHighlighted\"\n let-customActions=\"customActions\"\n >\n <stream-message\n [message]=\"messageInput\"\n [isLastSentMessage]=\"isLastSentMessage\"\n [enabledMessageActions]=\"enabledMessageActions\"\n [mode]=\"mode\"\n [isHighlighted]=\"isHighlighted\"\n [customActions]=\"customActions\"\n ></stream-message>\n </ng-template>\n <ng-container\n *ngTemplateOutlet=\"\n messageTemplate || defaultMessageTemplate;\n context: {\n message: message,\n isLastSentMessage: !!(\n lastSentMessageId && message?.id === lastSentMessageId\n ),\n enabledMessageActions: enabledMessageActions,\n mode: mode,\n isHighlighted: message?.id === highlightedMessageId,\n customActions: customMessageActions\n }\n \"\n ></ng-container>\n</ng-template>\n\n<ng-template #dateSeparator let-date=\"date\" let-parsedDate=\"parsedDate\">\n <ng-container *ngIf=\"displayDateSeparator\">\n <ng-container\n *ngTemplateOutlet=\"\n customDateSeparatorTemplate || defaultDateSeparator;\n context: {\n date: date,\n parsedDate: parsedDate\n }\n \"\n ></ng-container>\n </ng-container>\n\n <ng-template\n #defaultDateSeparator\n let-date=\"date\"\n let-parsedDate=\"parsedDate\"\n >\n <div data-testid=\"date-separator\" class=\"str-chat__date-separator\">\n <hr\n *ngIf=\"\n dateSeparatorTextPos === 'right' || dateSeparatorTextPos === 'center'\n \"\n class=\"str-chat__date-separator-line\"\n />\n <div class=\"str-chat__date-separator-date\">\n {{ parsedDate }}\n </div>\n <hr\n *ngIf=\"\n dateSeparatorTextPos === 'left' || dateSeparatorTextPos === 'center'\n \"\n class=\"str-chat__date-separator-line\"\n />\n </div>\n </ng-template>\n</ng-template>\n\n<ng-template #defaultNewMessagesIndicator let-unreadCount=\"unreadCount\">\n <div class=\"str-chat__unread-messages-separator\">\n <ng-container\n *ngIf=\"\n unreadCount > 0 && !hideUnreadCountForNotificationAndIndicator;\n else noUnreadCount\n \"\n >\n {{\n (unreadCount === 1\n ? \"streamChat.\\{\\{count\\}\\} unread message\"\n : \"streamChat.\\{\\{count\\}\\} unread messages\"\n ) | translate: { count: unreadCount }\n }}\n </ng-container>\n <ng-template #noUnreadCount>\n {{ \"streamChat.Unread messages\" | translate }}\n </ng-template>\n </div>\n</ng-template>\n", components: [{ type: IconPlaceholderComponent, selector: "stream-icon-placeholder", inputs: ["icon", "size"] }, { type: LoadingIndicatorComponent, selector: "stream-loading-indicator", inputs: ["size", "color"] }, { type: IconComponent, selector: "stream-icon", inputs: ["icon", "size"] }, { type: MessageComponent, selector: "stream-message", inputs: ["message", "enabledMessageActions", "isLastSentMessage", "mode", "isHighlighted", "customActions"] }], directives: [{ type: i8__namespace.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i8__namespace.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet"] }, { type: i8__namespace.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }], pipes: { "translate": i9__namespace.TranslatePipe, "async": i8__namespace.AsyncPipe }, changeDetection: i0__namespace.ChangeDetectionStrategy.OnPush });
|
|
8148
|
+
MessageListComponent.ɵcmp = i0__namespace.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.5", type: MessageListComponent, selector: "stream-message-list", inputs: { mode: "mode", direction: "direction", messageOptionsTrigger: "messageOptionsTrigger", hideJumpToLatestButtonDuringScroll: "hideJumpToLatestButtonDuringScroll", customMessageActions: "customMessageActions", displayDateSeparator: "displayDateSeparator", displayUnreadSeparator: "displayUnreadSeparator", dateSeparatorTextPos: "dateSeparatorTextPos", openMessageListAt: "openMessageListAt", hideUnreadCountForNotificationAndIndicator: "hideUnreadCountForNotificationAndIndicator", displayLoadingIndicator: "displayLoadingIndicator", limitNumberOfMessagesInList: "limitNumberOfMessagesInList" }, host: { properties: { "class": "this.class" } }, viewQueries: [{ propertyName: "scrollContainer", first: true, predicate: ["scrollContainer"], descendants: true }, { propertyName: "parentMessageElement", first: true, predicate: ["parentMessageElement"], descendants: true }], usesOnChanges: true, ngImport: i0__namespace, template: "<ng-container\n *ngIf=\"\n lastReadMessageId &&\n isUnreadNotificationVisible &&\n openMessageListAt === 'last-message' &&\n displayUnreadSeparator\n \"\n>\n <ng-container\n *ngTemplateOutlet=\"\n customnewMessagesNotificationTemplate ||\n defaultUnreadMessagesNotification;\n context: {\n unreadCount: unreadCount,\n onDismiss: messageNotificationDismissClicked,\n onJump: messageNotificationJumpClicked\n }\n \"\n ></ng-container>\n</ng-container>\n<ng-template\n #defaultUnreadMessagesNotification\n let-unreadCount=\"unreadCount\"\n let-onDismiss=\"onDismiss\"\n let-onJump=\"onJump\"\n>\n <div\n class=\"str-chat__unread-messages-notification\"\n data-testid=\"unread-messages-notification\"\n >\n <button\n data-testid=\"unread-messages-notification-jump-to-message\"\n (click)=\"onJump()\"\n >\n <ng-container\n *ngIf=\"\n unreadCount > 0 && !hideUnreadCountForNotificationAndIndicator;\n else noUnreadCount\n \"\n >\n {{\n (unreadCount === 1\n ? \"streamChat.\\{\\{count\\}\\} unread message\"\n : \"streamChat.\\{\\{count\\}\\} unread messages\"\n ) | translate: { count: unreadCount }\n }}\n </ng-container>\n <ng-template #noUnreadCount>\n {{ \"streamChat.Unread messages\" | translate }}\n </ng-template>\n </button>\n <button\n data-testid=\"unread-messages-notification-dismiss\"\n (click)=\"onDismiss()\"\n >\n <stream-icon-placeholder icon=\"close\"></stream-icon-placeholder>\n </button>\n </div>\n</ng-template>\n<div #scrollContainer data-testid=\"scroll-container\" class=\"str-chat__list\">\n <ng-container *ngIf=\"mode === 'main' && isEmpty && emptyListTemplate\">\n <ng-container *ngTemplateOutlet=\"emptyListTemplate\"></ng-container>\n </ng-container>\n <div class=\"str-chat__reverse-infinite-scroll str-chat__message-list-scroll\">\n <ul\n class=\"str-chat__ul\"\n [class.str-chat__message-options-in-bubble]=\"\n messageOptionsTrigger === 'message-bubble'\n \"\n >\n <li\n #parentMessageElement\n *ngIf=\"mode === 'thread' && parentMessage\"\n data-testid=\"parent-message\"\n class=\"str-chat__parent-message-li\"\n >\n <ng-container\n *ngTemplateOutlet=\"\n messageTemplateContainer;\n context: { message: parentMessage, index: 'parent' }\n \"\n ></ng-container>\n <div data-testid=\"reply-count\" class=\"str-chat__thread-start\">\n {{parentMessage?.reply_count === 1 ? ('streamChat.1 reply' | translate) : ('streamChat.{{ replyCount }}\n replies' | translate:replyCountParam)}}\n </div>\n </li>\n <ng-container *ngIf=\"mode === 'thread' && isEmpty && emptyListTemplate\">\n <ng-container *ngTemplateOutlet=\"emptyListTemplate\"></ng-container>\n </ng-container>\n <stream-loading-indicator\n data-testid=\"top-loading-indicator\"\n *ngIf=\"\n isLoading && direction === 'bottom-to-top' && displayLoadingIndicator\n \"\n ></stream-loading-indicator>\n <ng-container *ngIf=\"messages$ | async as messages\">\n <ng-container\n *ngFor=\"\n let message of messages;\n let i = index;\n let isFirst = first;\n let isLast = last;\n trackBy: trackByMessageId\n \"\n >\n <ng-container *ngIf=\"isFirst\">\n <ng-container\n *ngTemplateOutlet=\"\n dateSeparator;\n context: {\n date: message.created_at,\n parsedDate: parseDate(message.created_at)\n }\n \"\n ></ng-container>\n </ng-container>\n <li\n tabindex=\"0\"\n data-testclass=\"message\"\n class=\"str-chat__li str-chat__li--{{ groupStyles[i] }}\"\n id=\"{{ message.id }}\"\n >\n <ng-container\n *ngTemplateOutlet=\"\n messageTemplateContainer;\n context: { message: message, index: i }\n \"\n ></ng-container>\n </li>\n <ng-container\n *ngIf=\"\n (lastReadMessageId === message?.id &&\n direction === 'bottom-to-top') ||\n (direction === 'top-to-bottom' &&\n lastReadMessageId === messages[i + 1]?.id)\n \"\n >\n <li\n *ngIf=\"displayUnreadSeparator\"\n id=\"stream-chat-new-message-indicator\"\n data-testid=\"new-messages-indicator\"\n class=\"str-chat__li str-chat__unread-messages-separator-wrapper\"\n >\n <ng-container\n *ngTemplateOutlet=\"\n customnewMessagesIndicatorTemplate ||\n defaultNewMessagesIndicator;\n context: { unreadCount: unreadCount }\n \"\n ></ng-container>\n </li>\n </ng-container>\n <ng-container *ngIf=\"isNextMessageOnSeparateDate[i]\">\n <ng-container\n *ngTemplateOutlet=\"\n dateSeparator;\n context: {\n date: messages[i + 1].created_at,\n parsedDate: parseDate(messages[i + 1].created_at)\n }\n \"\n ></ng-container>\n </ng-container>\n </ng-container>\n </ng-container>\n <stream-loading-indicator\n data-testid=\"bottom-loading-indicator\"\n *ngIf=\"\n isLoading && direction === 'top-to-bottom' && displayLoadingIndicator\n \"\n ></stream-loading-indicator>\n </ul>\n <ng-template #defaultTypingIndicator let-usersTyping$=\"usersTyping$\">\n <!-- eslint-disable-next-line @angular-eslint/template/no-any -->\n <ng-container *ngIf=\"$any(usersTyping$ | async) as users\">\n <div\n *ngIf=\"users.length > 0\"\n data-testid=\"typing-indicator\"\n class=\"str-chat__typing-indicator str-chat__typing-indicator--typing\"\n >\n <div class=\"str-chat__typing-indicator__dots\">\n <span class=\"str-chat__typing-indicator__dot\"></span>\n <span class=\"str-chat__typing-indicator__dot\"></span>\n <span class=\"str-chat__typing-indicator__dot\"></span>\n </div>\n <div\n data-testid=\"typing-users\"\n class=\"str-chat__typing-indicator__users\"\n >\n {{\n users.length === 1\n ? (\"streamChat.user is typing\"\n | translate: { user: getTypingIndicatorText(users) })\n : (\"streamChat.users are typing\"\n | translate: { users: getTypingIndicatorText(users) })\n }}\n </div>\n </div>\n </ng-container>\n </ng-template>\n <ng-container\n *ngTemplateOutlet=\"\n typingIndicatorTemplate || defaultTypingIndicator;\n context: getTypingIndicatorContext()\n \"\n ></ng-container>\n </div>\n</div>\n<div class=\"str-chat__jump-to-latest-message\">\n <button\n data-testid=\"scroll-to-latest\"\n *ngIf=\"isUserScrolled && isJumpToLatestButtonVisible\"\n class=\"\n str-chat__message-notification-scroll-to-latest\n str-chat__message-notification-scroll-to-latest-right\n str-chat__circle-fab\n \"\n (keyup.enter)=\"jumpToLatestMessage()\"\n (click)=\"jumpToLatestMessage()\"\n >\n <stream-icon\n class=\"str-chat__jump-to-latest-icon str-chat__circle-fab-icon\"\n [icon]=\"direction === 'bottom-to-top' ? 'arrow-down' : 'arrow-up'\"\n ></stream-icon>\n <div\n *ngIf=\"newMessageCountWhileBeingScrolled > 0\"\n class=\"\n str-chat__message-notification\n str-chat__message-notification-scroll-to-latest-unread-count\n str-chat__jump-to-latest-unread-count\n \"\n >\n {{ newMessageCountWhileBeingScrolled }}\n </div>\n </button>\n</div>\n\n<ng-template #messageTemplateContainer let-message=\"message\" let-index=\"index\">\n <ng-template\n #defaultMessageTemplate\n let-messageInput=\"message\"\n let-isLastSentMessage=\"isLastSentMessage\"\n let-enabledMessageActions=\"enabledMessageActions\"\n let-mode=\"mode\"\n let-isHighlighted=\"isHighlighted\"\n let-customActions=\"customActions\"\n >\n <stream-message\n [message]=\"messageInput\"\n [isLastSentMessage]=\"isLastSentMessage\"\n [enabledMessageActions]=\"enabledMessageActions\"\n [mode]=\"mode\"\n [isHighlighted]=\"isHighlighted\"\n [customActions]=\"customActions\"\n ></stream-message>\n </ng-template>\n <ng-container\n *ngTemplateOutlet=\"\n messageTemplate || defaultMessageTemplate;\n context: {\n message: message,\n isLastSentMessage: !!(\n lastSentMessageId && message?.id === lastSentMessageId\n ),\n enabledMessageActions: enabledMessageActions,\n mode: mode,\n isHighlighted: message?.id === highlightedMessageId,\n customActions: customMessageActions\n }\n \"\n ></ng-container>\n</ng-template>\n\n<ng-template #dateSeparator let-date=\"date\" let-parsedDate=\"parsedDate\">\n <ng-container *ngIf=\"displayDateSeparator\">\n <ng-container\n *ngTemplateOutlet=\"\n customDateSeparatorTemplate || defaultDateSeparator;\n context: {\n date: date,\n parsedDate: parsedDate\n }\n \"\n ></ng-container>\n </ng-container>\n\n <ng-template\n #defaultDateSeparator\n let-date=\"date\"\n let-parsedDate=\"parsedDate\"\n >\n <div data-testid=\"date-separator\" class=\"str-chat__date-separator\">\n <hr\n *ngIf=\"\n dateSeparatorTextPos === 'right' || dateSeparatorTextPos === 'center'\n \"\n class=\"str-chat__date-separator-line\"\n />\n <div class=\"str-chat__date-separator-date\">\n {{ parsedDate }}\n </div>\n <hr\n *ngIf=\"\n dateSeparatorTextPos === 'left' || dateSeparatorTextPos === 'center'\n \"\n class=\"str-chat__date-separator-line\"\n />\n </div>\n </ng-template>\n</ng-template>\n\n<ng-template #defaultNewMessagesIndicator let-unreadCount=\"unreadCount\">\n <div class=\"str-chat__unread-messages-separator\">\n <ng-container\n *ngIf=\"\n unreadCount > 0 && !hideUnreadCountForNotificationAndIndicator;\n else noUnreadCount\n \"\n >\n {{\n (unreadCount === 1\n ? \"streamChat.\\{\\{count\\}\\} unread message\"\n : \"streamChat.\\{\\{count\\}\\} unread messages\"\n ) | translate: { count: unreadCount }\n }}\n </ng-container>\n <ng-template #noUnreadCount>\n {{ \"streamChat.Unread messages\" | translate }}\n </ng-template>\n </div>\n</ng-template>\n", components: [{ type: IconPlaceholderComponent, selector: "stream-icon-placeholder", inputs: ["icon", "size"] }, { type: LoadingIndicatorComponent, selector: "stream-loading-indicator", inputs: ["size", "color"] }, { type: IconComponent, selector: "stream-icon", inputs: ["icon", "size"] }, { type: MessageComponent, selector: "stream-message", inputs: ["message", "enabledMessageActions", "isLastSentMessage", "mode", "isHighlighted", "customActions"] }], directives: [{ type: i8__namespace.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i8__namespace.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet"] }, { type: i8__namespace.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }], pipes: { "translate": i9__namespace.TranslatePipe, "async": i8__namespace.AsyncPipe }, changeDetection: i0__namespace.ChangeDetectionStrategy.OnPush });
|
|
8059
8149
|
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.5", ngImport: i0__namespace, type: MessageListComponent, decorators: [{
|
|
8060
8150
|
type: i0.Component,
|
|
8061
8151
|
args: [{
|
|
@@ -8086,6 +8176,8 @@
|
|
|
8086
8176
|
type: i0.Input
|
|
8087
8177
|
}], displayLoadingIndicator: [{
|
|
8088
8178
|
type: i0.Input
|
|
8179
|
+
}], limitNumberOfMessagesInList: [{
|
|
8180
|
+
type: i0.Input
|
|
8089
8181
|
}], scrollContainer: [{
|
|
8090
8182
|
type: i0.ViewChild,
|
|
8091
8183
|
args: ['scrollContainer']
|