stream-chat-angular 3.0.0-beta.1 → 3.0.0-beta.2
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 +366 -273
- package/bundles/stream-chat-angular.umd.js.map +1 -1
- package/esm2015/assets/version.js +2 -2
- package/esm2015/lib/channel-header/channel-header.component.js +26 -9
- package/esm2015/lib/channel-list/channel-list.component.js +23 -13
- package/esm2015/lib/channel.service.js +71 -59
- package/esm2015/lib/chat-client.service.js +26 -2
- package/esm2015/lib/custom-templates.service.js +55 -0
- package/esm2015/lib/message/message.component.js +26 -17
- package/esm2015/lib/message-actions-box/message-actions-box.component.js +28 -12
- package/esm2015/lib/message-input/autocomplete-textarea/autocomplete-textarea.component.js +13 -13
- package/esm2015/lib/message-input/message-input-config.service.js +1 -1
- package/esm2015/lib/message-input/message-input.component.js +25 -34
- package/esm2015/lib/message-input/textarea.directive.js +2 -18
- package/esm2015/lib/message-input/textarea.interface.js +1 -1
- package/esm2015/lib/message-list/message-list.component.js +31 -22
- package/esm2015/lib/notification/notification.component.js +1 -1
- package/esm2015/lib/notification-list/notification-list.component.js +7 -4
- package/esm2015/lib/notification.service.js +34 -18
- package/esm2015/lib/types.js +1 -1
- package/esm2015/public-api.js +2 -1
- package/fesm2015/stream-chat-angular.js +317 -182
- package/fesm2015/stream-chat-angular.js.map +1 -1
- package/lib/channel-header/channel-header.component.d.ts +12 -2
- package/lib/channel-list/channel-list.component.d.ts +12 -9
- package/lib/channel.service.d.ts +13 -13
- package/lib/chat-client.service.d.ts +7 -1
- package/lib/custom-templates.service.d.ts +48 -0
- package/lib/message/message.component.d.ts +11 -13
- package/lib/message-actions-box/message-actions-box.component.d.ts +12 -9
- package/lib/message-input/autocomplete-textarea/autocomplete-textarea.component.d.ts +6 -10
- package/lib/message-input/message-input-config.service.d.ts +0 -14
- package/lib/message-input/message-input.component.d.ts +11 -18
- package/lib/message-input/textarea.directive.d.ts +2 -5
- package/lib/message-input/textarea.interface.d.ts +1 -4
- package/lib/message-list/message-list.component.d.ts +10 -22
- package/lib/notification/notification.component.d.ts +1 -1
- package/lib/notification-list/notification-list.component.d.ts +6 -2
- package/lib/notification.service.d.ts +14 -13
- package/lib/types.d.ts +44 -1
- package/package.json +1 -1
- package/public-api.d.ts +1 -0
- package/src/assets/version.ts +1 -1
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { AfterViewChecked, OnChanges, OnDestroy, OnInit, SimpleChanges, TemplateRef } from '@angular/core';
|
|
2
2
|
import { ChannelService } from '../channel.service';
|
|
3
3
|
import { Observable } from 'rxjs';
|
|
4
|
-
import {
|
|
4
|
+
import { MessageContext, StreamMessage, TypingIndicatorContext } from '../types';
|
|
5
5
|
import { ChatClientService } from '../chat-client.service';
|
|
6
6
|
import { GroupStyle } from './group-styles';
|
|
7
7
|
import { ImageLoadService } from './image-load.service';
|
|
8
8
|
import { UserResponse } from 'stream-chat';
|
|
9
|
+
import { CustomTemplatesService } from '../custom-templates.service';
|
|
9
10
|
import * as i0 from "@angular/core";
|
|
10
11
|
/**
|
|
11
12
|
* The `MessageList` component renders a scrollable list of messages.
|
|
@@ -14,28 +15,13 @@ export declare class MessageListComponent implements AfterViewChecked, OnChanges
|
|
|
14
15
|
private channelService;
|
|
15
16
|
private chatClientService;
|
|
16
17
|
private imageLoadService;
|
|
17
|
-
|
|
18
|
-
* By default, the [default message component](./MessageComponent.mdx) is used. To change the contents of the message, provide [your own custom message template](./MessageComponent.mdx/#customization).
|
|
19
|
-
*/
|
|
20
|
-
messageTemplate: TemplateRef<any> | undefined;
|
|
21
|
-
/**
|
|
22
|
-
* The input used for message edit. By default, the [default message input component](./MessageInputComponent.mdx) is used. To change the input for message edit, provide [your own custom template](./MessageInputComponent.mdx/#customization).
|
|
23
|
-
*/
|
|
24
|
-
messageInputTemplate: TemplateRef<any> | undefined;
|
|
25
|
-
/**
|
|
26
|
-
* The template used to display a mention in a message. It receives the mentioned user in a variable called `user` with the type [`UserResponse`](https://github.com/GetStream/stream-chat-js/blob/master/src/types.ts). You can provide your own template if you want to [add actions to mentions](../code-examples/mention-actions.mdx).
|
|
27
|
-
*/
|
|
28
|
-
mentionTemplate: TemplateRef<any> | undefined;
|
|
29
|
-
/**
|
|
30
|
-
* You can provide your own typing indicator template instead of the default one.
|
|
31
|
-
*/
|
|
32
|
-
typingIndicatorTemplate: TemplateRef<{
|
|
33
|
-
usersTyping$: Observable<UserResponse<DefaultUserType>[]>;
|
|
34
|
-
}> | undefined;
|
|
18
|
+
private customTemplatesService;
|
|
35
19
|
/**
|
|
36
20
|
* Determines if the message list should display channel messages or [thread messages](https://getstream.io/chat/docs/javascript/threads/?language=javascript).
|
|
37
21
|
*/
|
|
38
22
|
mode: 'main' | 'thread';
|
|
23
|
+
typingIndicatorTemplate: TemplateRef<TypingIndicatorContext> | undefined;
|
|
24
|
+
messageTemplate: TemplateRef<MessageContext> | undefined;
|
|
39
25
|
messages$: Observable<StreamMessage[]>;
|
|
40
26
|
enabledMessageActions: string[];
|
|
41
27
|
private class;
|
|
@@ -57,19 +43,21 @@ export declare class MessageListComponent implements AfterViewChecked, OnChanges
|
|
|
57
43
|
private prevScrollTop;
|
|
58
44
|
private usersTypingInChannel$;
|
|
59
45
|
private usersTypingInThread$;
|
|
60
|
-
constructor(channelService: ChannelService, chatClientService: ChatClientService, imageLoadService: ImageLoadService);
|
|
46
|
+
constructor(channelService: ChannelService, chatClientService: ChatClientService, imageLoadService: ImageLoadService, customTemplatesService: CustomTemplatesService);
|
|
61
47
|
ngOnInit(): void;
|
|
62
48
|
ngOnChanges(changes: SimpleChanges): void;
|
|
63
49
|
ngAfterViewChecked(): void;
|
|
64
50
|
ngOnDestroy(): void;
|
|
65
|
-
get usersTyping$(): Observable<UserResponse<DefaultUserType<import("../types").DefaultUserTypeInternal>>[]>;
|
|
66
51
|
trackByMessageId(index: number, item: StreamMessage): string;
|
|
67
52
|
trackByUserId(index: number, user: UserResponse): string;
|
|
68
53
|
scrollToBottom(): void;
|
|
69
54
|
scrolled(): void;
|
|
55
|
+
getTypingIndicatorContext(): TypingIndicatorContext;
|
|
56
|
+
getMessageContext(message: StreamMessage): MessageContext;
|
|
70
57
|
private preserveScrollbarPosition;
|
|
71
58
|
private setMessages$;
|
|
72
59
|
private resetScrollState;
|
|
60
|
+
private get usersTyping$();
|
|
73
61
|
static ɵfac: i0.ɵɵFactoryDeclaration<MessageListComponent, never>;
|
|
74
|
-
static ɵcmp: i0.ɵɵComponentDeclaration<MessageListComponent, "stream-message-list", never, { "
|
|
62
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<MessageListComponent, "stream-message-list", never, { "mode": "mode"; }, {}, never, never>;
|
|
75
63
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { NotificationType } from '../
|
|
1
|
+
import { NotificationType } from '../types';
|
|
2
2
|
import * as i0 from "@angular/core";
|
|
3
3
|
/**
|
|
4
4
|
* The `Notification` component displays a notification within the [`NotificationList`](./NotificationListComponent.mdx)
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Observable } from 'rxjs';
|
|
2
|
-
import {
|
|
2
|
+
import { NotificationService } from '../notification.service';
|
|
3
|
+
import { NotificationPayload } from '../types';
|
|
3
4
|
import * as i0 from "@angular/core";
|
|
4
5
|
/**
|
|
5
6
|
* The `NotificationList` component displays the list of active notifications.
|
|
@@ -8,7 +9,10 @@ export declare class NotificationListComponent {
|
|
|
8
9
|
private notificationService;
|
|
9
10
|
notifications$: Observable<NotificationPayload[]>;
|
|
10
11
|
constructor(notificationService: NotificationService);
|
|
11
|
-
|
|
12
|
+
trackById(_: number, item: NotificationPayload): string;
|
|
13
|
+
getTemplateContext(notification: NotificationPayload): {
|
|
14
|
+
dismissFn: Function;
|
|
15
|
+
};
|
|
12
16
|
static ɵfac: i0.ɵɵFactoryDeclaration<NotificationListComponent, never>;
|
|
13
17
|
static ɵcmp: i0.ɵɵComponentDeclaration<NotificationListComponent, "stream-notification-list", never, {}, {}, never, never>;
|
|
14
18
|
}
|
|
@@ -1,11 +1,7 @@
|
|
|
1
|
+
import { TemplateRef } from '@angular/core';
|
|
1
2
|
import { Observable } from 'rxjs';
|
|
3
|
+
import { NotificationPayload, NotificationType } from './types';
|
|
2
4
|
import * as i0 from "@angular/core";
|
|
3
|
-
export declare type NotificationType = 'success' | 'error';
|
|
4
|
-
export declare type NotificationPayload = {
|
|
5
|
-
type: NotificationType;
|
|
6
|
-
text: string;
|
|
7
|
-
translateParams?: Object;
|
|
8
|
-
};
|
|
9
5
|
/**
|
|
10
6
|
* The `NotificationService` can be used to add or remove notifications. By default the [`NotificationList`](../components/NotificationListComponent.mdx) component displays the currently active notifications.
|
|
11
7
|
*/
|
|
@@ -18,22 +14,27 @@ export declare class NotificationService {
|
|
|
18
14
|
constructor();
|
|
19
15
|
/**
|
|
20
16
|
* Displays a notification for the given amount of time.
|
|
21
|
-
* @param
|
|
17
|
+
* @param content The text of the notification or the HTML template for the notification
|
|
22
18
|
* @param type The type of the notification
|
|
23
19
|
* @param timeout The number of milliseconds while the notification should be visible
|
|
24
|
-
* @param translateParams Translation parameters for the `text
|
|
20
|
+
* @param translateParams Translation parameters for the `content` (for text notifications)
|
|
21
|
+
* @param templateContext The input of the notification template (for HTML notifications)
|
|
25
22
|
* @returns A method to clear the notification (before the timeout).
|
|
26
23
|
*/
|
|
27
|
-
addTemporaryNotification(
|
|
24
|
+
addTemporaryNotification<T>(content: string | TemplateRef<T>, type?: NotificationType, timeout?: number, translateParams?: Object, templateContext?: T): () => void;
|
|
28
25
|
/**
|
|
29
26
|
* Displays a notification, that will be visible until it's removed.
|
|
30
|
-
* @param
|
|
27
|
+
* @param content The text of the notification or the HTML template for the notification
|
|
31
28
|
* @param type The type of the notification
|
|
32
|
-
* @param translateParams Translation parameters for the `text
|
|
29
|
+
* @param translateParams Translation parameters for the `content` (for text notifications)
|
|
30
|
+
* @param templateContext The input of the notification template (for HTML notifications)
|
|
33
31
|
* @returns A method to clear the notification.
|
|
34
32
|
*/
|
|
35
|
-
addPermanentNotification
|
|
36
|
-
|
|
33
|
+
addPermanentNotification<T = {
|
|
34
|
+
[key: string]: any;
|
|
35
|
+
dismissFn: () => {};
|
|
36
|
+
}>(content: string | TemplateRef<T>, type?: NotificationType, translateParams?: Object, templateContext?: T): () => void;
|
|
37
|
+
private createNotification;
|
|
37
38
|
private removeNotification;
|
|
38
39
|
static ɵfac: i0.ɵɵFactoryDeclaration<NotificationService, never>;
|
|
39
40
|
static ɵprov: i0.ɵɵInjectableDeclaration<NotificationService>;
|
package/lib/types.d.ts
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { TemplateRef } from '@angular/core';
|
|
2
|
+
import { Observable, Subject } from 'rxjs';
|
|
3
|
+
import type { Attachment, Channel, ChannelMemberResponse, CommandResponse, Event, FormatMessageResponse, LiteralStringForUnion, Mute, UserResponse } from 'stream-chat';
|
|
2
4
|
export declare type UnknownType = Record<string, unknown>;
|
|
3
5
|
export declare type CustomTrigger = {
|
|
4
6
|
[key: string]: {
|
|
@@ -55,3 +57,44 @@ export declare type MentionAutcompleteListItem = (ChannelMemberResponse | UserRe
|
|
|
55
57
|
export declare type ComandAutocompleteListItem = CommandResponse & {
|
|
56
58
|
autocompleteLabel: string;
|
|
57
59
|
};
|
|
60
|
+
export declare type NotificationType = 'success' | 'error' | 'info';
|
|
61
|
+
export declare type NotificationPayload<T = {}> = {
|
|
62
|
+
id: string;
|
|
63
|
+
type: NotificationType;
|
|
64
|
+
text?: string;
|
|
65
|
+
translateParams?: Object;
|
|
66
|
+
template?: TemplateRef<T>;
|
|
67
|
+
templateContext?: T;
|
|
68
|
+
dismissFn: Function;
|
|
69
|
+
};
|
|
70
|
+
export declare type ChannelPreviewContext = {
|
|
71
|
+
channel: Channel;
|
|
72
|
+
};
|
|
73
|
+
export declare type MessageInputContext = {
|
|
74
|
+
isFileUploadEnabled: boolean | undefined;
|
|
75
|
+
areMentionsEnabled: boolean | undefined;
|
|
76
|
+
mentionScope: 'channel' | 'application' | undefined;
|
|
77
|
+
mode: 'thread' | 'main' | undefined;
|
|
78
|
+
isMultipleFileUploadEnabled: boolean | undefined;
|
|
79
|
+
message: StreamMessage | undefined;
|
|
80
|
+
messageUpdateHandler: Function | undefined;
|
|
81
|
+
};
|
|
82
|
+
export declare type MentionTemplateContext = {
|
|
83
|
+
content: string;
|
|
84
|
+
user: UserResponse;
|
|
85
|
+
};
|
|
86
|
+
export declare type EmojiPickerContext = {
|
|
87
|
+
emojiInput$: Subject<string>;
|
|
88
|
+
};
|
|
89
|
+
export declare type TypingIndicatorContext = {
|
|
90
|
+
usersTyping$: Observable<UserResponse<DefaultUserType>[]>;
|
|
91
|
+
};
|
|
92
|
+
export declare type MessageContext = {
|
|
93
|
+
message: StreamMessage | undefined;
|
|
94
|
+
enabledMessageActions: string[];
|
|
95
|
+
isLastSentMessage: boolean | undefined;
|
|
96
|
+
mode: 'thread' | 'main';
|
|
97
|
+
};
|
|
98
|
+
export declare type ChannelActionsContext = {
|
|
99
|
+
channel: Channel;
|
|
100
|
+
};
|
package/package.json
CHANGED
package/public-api.d.ts
CHANGED
|
@@ -44,4 +44,5 @@ export * from './lib/stream-avatar.module';
|
|
|
44
44
|
export * from './lib/stream-autocomplete-textarea.module';
|
|
45
45
|
export * from './lib/stream-textarea.module';
|
|
46
46
|
export * from './lib/injection-tokens';
|
|
47
|
+
export * from './lib/custom-templates.service';
|
|
47
48
|
export * from './lib/types';
|
package/src/assets/version.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const version = '3.0.0-beta.
|
|
1
|
+
export const version = '3.0.0-beta.2';
|