stream-chat-angular 5.8.3 → 5.8.4
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/esm2020/assets/version.mjs +2 -2
- package/esm2020/lib/message-list/message-list.component.mjs +62 -46
- package/fesm2015/stream-chat-angular.mjs +61 -45
- package/fesm2015/stream-chat-angular.mjs.map +1 -1
- package/fesm2020/stream-chat-angular.mjs +62 -46
- package/fesm2020/stream-chat-angular.mjs.map +1 -1
- package/lib/message-list/message-list.component.d.ts +2 -0
- package/package.json +1 -1
- package/src/assets/version.ts +1 -1
|
@@ -22,7 +22,7 @@ import transliterate from '@stream-io/transliterate';
|
|
|
22
22
|
import * as i7 from 'angular-mentions';
|
|
23
23
|
import { MentionModule } from 'angular-mentions';
|
|
24
24
|
|
|
25
|
-
const version = '5.8.
|
|
25
|
+
const version = '5.8.4';
|
|
26
26
|
|
|
27
27
|
/**
|
|
28
28
|
* The `NotificationService` can be used to add or remove notifications. By default the [`NotificationList`](../components/NotificationListComponent.mdx) component displays the currently active notifications.
|
|
@@ -7822,6 +7822,7 @@ class MessageListComponent {
|
|
|
7822
7822
|
this.isLatestMessageInList = true;
|
|
7823
7823
|
this.parsedDates = new Map();
|
|
7824
7824
|
this.isViewInited = false;
|
|
7825
|
+
this.jumpToMessageTimeouts = [];
|
|
7825
7826
|
this.forceRepaintSubject = new Subject();
|
|
7826
7827
|
this.isSafari = isSafari();
|
|
7827
7828
|
this.scrollPosition$ = new BehaviorSubject('bottom');
|
|
@@ -7850,6 +7851,9 @@ class MessageListComponent {
|
|
|
7850
7851
|
if (this.checkIfUnreadNotificationIsVisibleTimeout) {
|
|
7851
7852
|
clearTimeout(this.checkIfUnreadNotificationIsVisibleTimeout);
|
|
7852
7853
|
}
|
|
7854
|
+
this.jumpToMessageTimeouts.forEach((timeout) => clearTimeout(timeout));
|
|
7855
|
+
this.jumpToMessageTimeouts = [];
|
|
7856
|
+
this.highlightedMessageId = undefined;
|
|
7853
7857
|
this.isUnreadNotificationVisible = false;
|
|
7854
7858
|
this.parsedDates = new Map();
|
|
7855
7859
|
this.resetScrollState();
|
|
@@ -8056,6 +8060,7 @@ class MessageListComponent {
|
|
|
8056
8060
|
if (this.jumpToLatestButtonVisibilityTimeout) {
|
|
8057
8061
|
clearTimeout(this.jumpToLatestButtonVisibilityTimeout);
|
|
8058
8062
|
}
|
|
8063
|
+
this.jumpToMessageTimeouts.forEach((timeout) => clearTimeout(timeout));
|
|
8059
8064
|
this.disposeVirtualizedList();
|
|
8060
8065
|
}
|
|
8061
8066
|
trackByMessageId(_, item) {
|
|
@@ -8086,7 +8091,6 @@ class MessageListComponent {
|
|
|
8086
8091
|
this.scrollContainer.nativeElement.scrollTop = 0;
|
|
8087
8092
|
}
|
|
8088
8093
|
scrolled() {
|
|
8089
|
-
var _a;
|
|
8090
8094
|
if (this.scrollContainer.nativeElement.scrollHeight ===
|
|
8091
8095
|
this.scrollContainer.nativeElement.clientHeight) {
|
|
8092
8096
|
if (this.isJumpToLatestButtonVisible) {
|
|
@@ -8103,19 +8107,7 @@ class MessageListComponent {
|
|
|
8103
8107
|
}
|
|
8104
8108
|
}
|
|
8105
8109
|
this.scroll$.next();
|
|
8106
|
-
|
|
8107
|
-
const isUserScrolled = (this.direction === 'bottom-to-top'
|
|
8108
|
-
? scrollPosition !== 'bottom'
|
|
8109
|
-
: scrollPosition !== 'top') || !this.isLatestMessageInList;
|
|
8110
|
-
if (this.isUserScrolled !== isUserScrolled) {
|
|
8111
|
-
this.ngZone.run(() => {
|
|
8112
|
-
this.isUserScrolled = isUserScrolled;
|
|
8113
|
-
if (!this.isUserScrolled) {
|
|
8114
|
-
this.newMessageCountWhileBeingScrolled = 0;
|
|
8115
|
-
}
|
|
8116
|
-
this.cdRef.detectChanges();
|
|
8117
|
-
});
|
|
8118
|
-
}
|
|
8110
|
+
this.checkIfUserScrolled();
|
|
8119
8111
|
if (this.hideJumpToLatestButtonDuringScroll) {
|
|
8120
8112
|
if (this.isJumpToLatestButtonVisible) {
|
|
8121
8113
|
this.isJumpToLatestButtonVisible = false;
|
|
@@ -8132,31 +8124,6 @@ class MessageListComponent {
|
|
|
8132
8124
|
}
|
|
8133
8125
|
}, 100);
|
|
8134
8126
|
}
|
|
8135
|
-
const prevScrollPosition = this.scrollPosition$.getValue();
|
|
8136
|
-
if (this.direction === 'top-to-bottom') {
|
|
8137
|
-
if (scrollPosition === 'top') {
|
|
8138
|
-
scrollPosition = 'bottom';
|
|
8139
|
-
}
|
|
8140
|
-
else if (scrollPosition === 'bottom') {
|
|
8141
|
-
scrollPosition = 'top';
|
|
8142
|
-
}
|
|
8143
|
-
}
|
|
8144
|
-
if (prevScrollPosition !== scrollPosition && !this.isJumpingToMessage) {
|
|
8145
|
-
if (scrollPosition === 'top' || scrollPosition === 'bottom') {
|
|
8146
|
-
(_a = this.virtualizedList) === null || _a === void 0 ? void 0 : _a.virtualizedItems$.pipe(take(1)).subscribe((items) => {
|
|
8147
|
-
var _a, _b, _c, _d;
|
|
8148
|
-
this.messageIdToAnchorTo =
|
|
8149
|
-
scrollPosition === 'top'
|
|
8150
|
-
? (_a = items[0]) === null || _a === void 0 ? void 0 : _a.id
|
|
8151
|
-
: (_b = items[items.length - 1]) === null || _b === void 0 ? void 0 : _b.id;
|
|
8152
|
-
this.anchorMessageTopOffset = (_d = (_c = document
|
|
8153
|
-
.getElementById(this.messageIdToAnchorTo)) === null || _c === void 0 ? void 0 : _c.getBoundingClientRect()) === null || _d === void 0 ? void 0 : _d.top;
|
|
8154
|
-
});
|
|
8155
|
-
}
|
|
8156
|
-
this.ngZone.run(() => {
|
|
8157
|
-
this.scrollPosition$.next(scrollPosition);
|
|
8158
|
-
});
|
|
8159
|
-
}
|
|
8160
8127
|
}
|
|
8161
8128
|
jumpToFirstUnreadMessage() {
|
|
8162
8129
|
if (!this.lastReadMessageId) {
|
|
@@ -8198,6 +8165,47 @@ class MessageListComponent {
|
|
|
8198
8165
|
? this.emptyMainMessageListTemplate
|
|
8199
8166
|
: this.emptyThreadMessageListTemplate;
|
|
8200
8167
|
}
|
|
8168
|
+
checkIfUserScrolled() {
|
|
8169
|
+
var _a;
|
|
8170
|
+
let scrollPosition = this.getScrollPosition();
|
|
8171
|
+
const isUserScrolled = (this.direction === 'bottom-to-top'
|
|
8172
|
+
? scrollPosition !== 'bottom'
|
|
8173
|
+
: scrollPosition !== 'top') || !this.isLatestMessageInList;
|
|
8174
|
+
if (this.isUserScrolled !== isUserScrolled) {
|
|
8175
|
+
this.ngZone.run(() => {
|
|
8176
|
+
this.isUserScrolled = isUserScrolled;
|
|
8177
|
+
if (!this.isUserScrolled) {
|
|
8178
|
+
this.newMessageCountWhileBeingScrolled = 0;
|
|
8179
|
+
}
|
|
8180
|
+
this.cdRef.detectChanges();
|
|
8181
|
+
});
|
|
8182
|
+
}
|
|
8183
|
+
const prevScrollPosition = this.scrollPosition$.getValue();
|
|
8184
|
+
if (this.direction === 'top-to-bottom') {
|
|
8185
|
+
if (scrollPosition === 'top') {
|
|
8186
|
+
scrollPosition = 'bottom';
|
|
8187
|
+
}
|
|
8188
|
+
else if (scrollPosition === 'bottom') {
|
|
8189
|
+
scrollPosition = 'top';
|
|
8190
|
+
}
|
|
8191
|
+
}
|
|
8192
|
+
if (prevScrollPosition !== scrollPosition && !this.isJumpingToMessage) {
|
|
8193
|
+
if (scrollPosition === 'top' || scrollPosition === 'bottom') {
|
|
8194
|
+
(_a = this.virtualizedList) === null || _a === void 0 ? void 0 : _a.virtualizedItems$.pipe(take(1)).subscribe((items) => {
|
|
8195
|
+
var _a, _b, _c, _d;
|
|
8196
|
+
this.messageIdToAnchorTo =
|
|
8197
|
+
scrollPosition === 'top'
|
|
8198
|
+
? (_a = items[0]) === null || _a === void 0 ? void 0 : _a.id
|
|
8199
|
+
: (_b = items[items.length - 1]) === null || _b === void 0 ? void 0 : _b.id;
|
|
8200
|
+
this.anchorMessageTopOffset = (_d = (_c = document
|
|
8201
|
+
.getElementById(this.messageIdToAnchorTo)) === null || _c === void 0 ? void 0 : _c.getBoundingClientRect()) === null || _d === void 0 ? void 0 : _d.top;
|
|
8202
|
+
});
|
|
8203
|
+
}
|
|
8204
|
+
this.ngZone.run(() => {
|
|
8205
|
+
this.scrollPosition$.next(scrollPosition);
|
|
8206
|
+
});
|
|
8207
|
+
}
|
|
8208
|
+
}
|
|
8201
8209
|
preserveScrollbarPosition() {
|
|
8202
8210
|
var _a;
|
|
8203
8211
|
if (!this.messageIdToAnchorTo) {
|
|
@@ -8350,9 +8358,11 @@ class MessageListComponent {
|
|
|
8350
8358
|
}
|
|
8351
8359
|
scrollMessageIntoView(options, withRetry = true) {
|
|
8352
8360
|
const element = document.getElementById(options.messageId);
|
|
8361
|
+
this.jumpToMessageTimeouts.forEach((t) => clearTimeout(t));
|
|
8362
|
+
this.jumpToMessageTimeouts = [];
|
|
8353
8363
|
if (!element && withRetry) {
|
|
8354
8364
|
// If the message was newly inserted into activeChannelMessages$, the message will be rendered after the current change detection cycle -> wait for this cycle to complete
|
|
8355
|
-
setTimeout(() => this.scrollMessageIntoView(options, false));
|
|
8365
|
+
this.jumpToMessageTimeouts.push(setTimeout(() => this.scrollMessageIntoView(options, false)));
|
|
8356
8366
|
}
|
|
8357
8367
|
else if (element) {
|
|
8358
8368
|
const blockMapping = {
|
|
@@ -8360,7 +8370,9 @@ class MessageListComponent {
|
|
|
8360
8370
|
bottom: 'end',
|
|
8361
8371
|
middle: 'center',
|
|
8362
8372
|
};
|
|
8373
|
+
// We can't know when smooth scrolling ends, so we set the behavior to instant https://github.com/w3c/csswg-drafts/issues/3744
|
|
8363
8374
|
element.scrollIntoView({
|
|
8375
|
+
behavior: 'instant',
|
|
8364
8376
|
block: blockMapping[options.position],
|
|
8365
8377
|
});
|
|
8366
8378
|
if (options.position !== 'middle') {
|
|
@@ -8368,15 +8380,19 @@ class MessageListComponent {
|
|
|
8368
8380
|
? this.scrollToBottom()
|
|
8369
8381
|
: this.scrollToTop();
|
|
8370
8382
|
}
|
|
8371
|
-
setTimeout(() => {
|
|
8383
|
+
this.jumpToMessageTimeouts.push(setTimeout(() => {
|
|
8372
8384
|
this.isJumpingToMessage = false;
|
|
8373
|
-
|
|
8374
|
-
|
|
8385
|
+
if (!this.isUserScrolled) {
|
|
8386
|
+
this.checkIfUserScrolled();
|
|
8387
|
+
}
|
|
8388
|
+
}, 200));
|
|
8389
|
+
this.jumpToMessageTimeouts.push(setTimeout(() => {
|
|
8375
8390
|
this.highlightedMessageId = undefined;
|
|
8376
8391
|
this.firstUnreadMessageId = undefined;
|
|
8377
8392
|
this.isJumpingToLatestUnreadMessage = false;
|
|
8393
|
+
this.jumpToMessageTimeouts = [];
|
|
8378
8394
|
this.cdRef.detectChanges();
|
|
8379
|
-
}, 1000);
|
|
8395
|
+
}, 1000));
|
|
8380
8396
|
}
|
|
8381
8397
|
}
|
|
8382
8398
|
newMessageReceived(message) {
|