stream-chat-angular 4.30.0 → 4.31.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.
Files changed (38) hide show
  1. package/assets/version.d.ts +1 -1
  2. package/bundles/stream-chat-angular.umd.js +147 -59
  3. package/bundles/stream-chat-angular.umd.js.map +1 -1
  4. package/esm2015/assets/version.js +2 -2
  5. package/esm2015/lib/custom-templates.service.js +5 -1
  6. package/esm2015/lib/date-parser.service.js +40 -0
  7. package/esm2015/lib/message/message.component.js +17 -16
  8. package/esm2015/lib/message-list/message-list.component.js +42 -10
  9. package/esm2015/lib/parse-date.js +19 -0
  10. package/esm2015/lib/types.js +1 -1
  11. package/esm2015/public-api.js +3 -2
  12. package/fesm2015/stream-chat-angular.js +125 -41
  13. package/fesm2015/stream-chat-angular.js.map +1 -1
  14. package/lib/custom-templates.service.d.ts +5 -1
  15. package/lib/date-parser.service.d.ts +29 -0
  16. package/lib/message/message.component.d.ts +3 -1
  17. package/lib/message-list/message-list.component.d.ts +16 -3
  18. package/lib/parse-date.d.ts +1 -0
  19. package/lib/types.d.ts +4 -0
  20. package/package.json +1 -1
  21. package/public-api.d.ts +2 -1
  22. package/src/assets/styles/css/index.css +1 -1
  23. package/src/assets/styles/css/index.css.map +1 -1
  24. package/src/assets/styles/scss/Card.scss +27 -2
  25. package/src/assets/styles/v2/css/index.css +1 -1
  26. package/src/assets/styles/v2/css/index.css.map +1 -1
  27. package/src/assets/styles/v2/css/index.layout.css +1 -1
  28. package/src/assets/styles/v2/css/index.layout.css.map +1 -1
  29. package/src/assets/styles/v2/scss/Channel/Channel-layout.scss +4 -0
  30. package/src/assets/styles/v2/scss/Message/Message-layout.scss +4 -2
  31. package/src/assets/styles/v2/scss/MessageList/MessageList-layout.scss +4 -0
  32. package/src/assets/styles/v2/scss/Thread/Thread-layout.scss +5 -0
  33. package/src/assets/styles/v2/scss/TypingIndicator/TypingIndicator-layout.scss +4 -0
  34. package/src/assets/styles/v2/scss/_emoji-replacement.scss +40 -0
  35. package/src/assets/styles/v2/scss/index.layout.scss +1 -0
  36. package/src/assets/version.ts +1 -1
  37. package/esm2015/lib/message/parse-date.js +0 -8
  38. package/lib/message/parse-date.d.ts +0 -1
@@ -1,6 +1,6 @@
1
1
  import { TemplateRef } from '@angular/core';
2
2
  import { BehaviorSubject } from 'rxjs';
3
- import { AttachmentContext, AttachmentListContext, AttachmentPreviewListContext, AvatarContext, ChannelActionsContext, ChannelHeaderInfoContext, ChannelPreviewContext, CommandAutocompleteListItemContext, CustomAttachmentUploadContext, DeliveredStatusContext, EmojiPickerContext, IconContext, LoadingIndicatorContext, MentionAutcompleteListItemContext, MentionTemplateContext, MessageActionBoxItemContext, MessageActionsBoxContext, MessageContext, MessageInputContext, MessageReactionsContext, ModalContext, NotificationContext, ReadStatusContext, SendingStatusContext, SystemMessageContext, ThreadHeaderContext, TypingIndicatorContext } from './types';
3
+ import { AttachmentContext, AttachmentListContext, AttachmentPreviewListContext, AvatarContext, ChannelActionsContext, ChannelHeaderInfoContext, ChannelPreviewContext, CommandAutocompleteListItemContext, CustomAttachmentUploadContext, DateSeparatorContext, DeliveredStatusContext, EmojiPickerContext, IconContext, LoadingIndicatorContext, MentionAutcompleteListItemContext, MentionTemplateContext, MessageActionBoxItemContext, MessageActionsBoxContext, MessageContext, MessageInputContext, MessageReactionsContext, ModalContext, NotificationContext, ReadStatusContext, SendingStatusContext, SystemMessageContext, ThreadHeaderContext, TypingIndicatorContext } from './types';
4
4
  import * as i0 from "@angular/core";
5
5
  /**
6
6
  * A central location for registering your custom templates to override parts of the chat application.
@@ -184,6 +184,10 @@ export declare class CustomTemplatesService {
184
184
  * The template used to display [system messages](https://getstream.io/chat/docs/javascript/silent_messages/?language=javascript&q=system) indise the [message component](../components/MessageComponent.mdx)
185
185
  */
186
186
  systemMessageTemplate$: BehaviorSubject<TemplateRef<SystemMessageContext> | undefined>;
187
+ /**
188
+ * The template used to display the date separator inside the [message list](../components/MessageListComponent.mdx)
189
+ */
190
+ dateSeparatorTemplate$: BehaviorSubject<TemplateRef<DateSeparatorContext> | undefined>;
187
191
  constructor();
188
192
  static ɵfac: i0.ɵɵFactoryDeclaration<CustomTemplatesService, never>;
189
193
  static ɵprov: i0.ɵɵInjectableDeclaration<CustomTemplatesService>;
@@ -0,0 +1,29 @@
1
+ import * as i0 from "@angular/core";
2
+ /**
3
+ * The `DateParserService` parses dates into user-friendly string representations.
4
+ */
5
+ export declare class DateParserService {
6
+ /**
7
+ * Custom parser to override `parseDate`
8
+ */
9
+ customDateParser?: (date: Date) => string;
10
+ /**
11
+ * Custom parser to override `parseDateTime`
12
+ */
13
+ customDateTimeParser?: (date: Date) => string;
14
+ constructor();
15
+ /**
16
+ * Return a user-friendly string representation of the date (year, month and date)
17
+ * @param date
18
+ * @returns
19
+ */
20
+ parseDate(date: Date): string;
21
+ /**
22
+ * Return a user-friendly string representation of the date and time
23
+ * @param date
24
+ * @returns
25
+ */
26
+ parseDateTime(date: Date): string;
27
+ static ɵfac: i0.ɵɵFactoryDeclaration<DateParserService, never>;
28
+ static ɵprov: i0.ɵɵInjectableDeclaration<DateParserService>;
29
+ }
@@ -6,6 +6,7 @@ import { AttachmentListContext, MentionTemplateContext, MessageActionsBoxContext
6
6
  import { CustomTemplatesService } from '../custom-templates.service';
7
7
  import { ThemeService } from '../theme.service';
8
8
  import { NgxPopperjsTriggers, NgxPopperjsPlacements } from 'ngx-popperjs';
9
+ import { DateParserService } from '../date-parser.service';
9
10
  import * as i0 from "@angular/core";
10
11
  declare type MessagePart = {
11
12
  content: string;
@@ -20,6 +21,7 @@ export declare class MessageComponent implements OnInit, OnChanges, OnDestroy {
20
21
  private channelService;
21
22
  private customTemplatesService;
22
23
  private cdRef;
24
+ private dateParser;
23
25
  /**
24
26
  * The message to be displayed
25
27
  */
@@ -70,7 +72,7 @@ export declare class MessageComponent implements OnInit, OnChanges, OnDestroy {
70
72
  private user;
71
73
  private subscriptions;
72
74
  private container;
73
- constructor(chatClientService: ChatClientService, channelService: ChannelService, customTemplatesService: CustomTemplatesService, cdRef: ChangeDetectorRef, themeService: ThemeService);
75
+ constructor(chatClientService: ChatClientService, channelService: ChannelService, customTemplatesService: CustomTemplatesService, cdRef: ChangeDetectorRef, themeService: ThemeService, dateParser: DateParserService);
74
76
  ngOnInit(): void;
75
77
  ngOnChanges(changes: SimpleChanges): void;
76
78
  ngOnDestroy(): void;
@@ -1,11 +1,12 @@
1
1
  import { AfterViewChecked, AfterViewInit, OnChanges, OnDestroy, OnInit, SimpleChanges, TemplateRef } from '@angular/core';
2
2
  import { ChannelService } from '../channel.service';
3
3
  import { Observable } from 'rxjs';
4
- import { MessageContext, StreamMessage, TypingIndicatorContext, CustomMessageActionItem } from '../types';
4
+ import { MessageContext, StreamMessage, TypingIndicatorContext, CustomMessageActionItem, DateSeparatorContext } from '../types';
5
5
  import { ChatClientService } from '../chat-client.service';
6
6
  import { GroupStyle } from './group-styles';
7
7
  import { UserResponse } from 'stream-chat';
8
8
  import { CustomTemplatesService } from '../custom-templates.service';
9
+ import { DateParserService } from '../date-parser.service';
9
10
  import * as i0 from "@angular/core";
10
11
  /**
11
12
  * The `MessageList` component renders a scrollable list of messages.
@@ -14,6 +15,7 @@ export declare class MessageListComponent implements AfterViewChecked, OnChanges
14
15
  private channelService;
15
16
  private chatClientService;
16
17
  private customTemplatesService;
18
+ private dateParser;
17
19
  /**
18
20
  * Determines if the message list should display channel messages or [thread messages](https://getstream.io/chat/docs/javascript/threads/?language=javascript).
19
21
  */
@@ -35,7 +37,16 @@ export declare class MessageListComponent implements AfterViewChecked, OnChanges
35
37
  * A list of custom message actions to be displayed in the message action box
36
38
  */
37
39
  customMessageActions: CustomMessageActionItem<any>[];
40
+ /**
41
+ * If `true` date separators will be displayed
42
+ */
43
+ displayDateSeparator: boolean;
44
+ /**
45
+ * If date separators are displayed, you can set the horizontal position of the date text.
46
+ */
47
+ dateSeparatorTextPos: 'center' | 'right' | 'left';
38
48
  messageTemplate: TemplateRef<MessageContext> | undefined;
49
+ customDateSeparatorTemplate: TemplateRef<DateSeparatorContext> | undefined;
39
50
  messages$: Observable<StreamMessage[]>;
40
51
  enabledMessageActions: string[];
41
52
  private class;
@@ -62,7 +73,7 @@ export declare class MessageListComponent implements AfterViewChecked, OnChanges
62
73
  private usersTypingInChannel$;
63
74
  private usersTypingInThread$;
64
75
  private isLatestMessageInList;
65
- constructor(channelService: ChannelService, chatClientService: ChatClientService, customTemplatesService: CustomTemplatesService);
76
+ constructor(channelService: ChannelService, chatClientService: ChatClientService, customTemplatesService: CustomTemplatesService, dateParser: DateParserService);
66
77
  ngOnInit(): void;
67
78
  ngOnChanges(changes: SimpleChanges): void;
68
79
  ngAfterViewInit(): void;
@@ -76,6 +87,8 @@ export declare class MessageListComponent implements AfterViewChecked, OnChanges
76
87
  scrolled(): void;
77
88
  getTypingIndicatorContext(): TypingIndicatorContext;
78
89
  getTypingIndicatorText(users: UserResponse[]): string;
90
+ areOnSeparateDates(message: StreamMessage, nextMessage?: StreamMessage): boolean;
91
+ parseDate(date: Date): string;
79
92
  get replyCountParam(): {
80
93
  replyCount: number | undefined;
81
94
  };
@@ -89,5 +102,5 @@ export declare class MessageListComponent implements AfterViewChecked, OnChanges
89
102
  private scrollToLatestMessage;
90
103
  private newMessageReceived;
91
104
  static ɵfac: i0.ɵɵFactoryDeclaration<MessageListComponent, never>;
92
- static ɵcmp: i0.ɵɵComponentDeclaration<MessageListComponent, "stream-message-list", never, { "mode": "mode"; "direction": "direction"; "messageOptionsTrigger": "messageOptionsTrigger"; "hideJumpToLatestButtonDuringScroll": "hideJumpToLatestButtonDuringScroll"; "customMessageActions": "customMessageActions"; }, {}, never, never>;
105
+ static ɵcmp: i0.ɵɵComponentDeclaration<MessageListComponent, "stream-message-list", never, { "mode": "mode"; "direction": "direction"; "messageOptionsTrigger": "messageOptionsTrigger"; "hideJumpToLatestButtonDuringScroll": "hideJumpToLatestButtonDuringScroll"; "customMessageActions": "customMessageActions"; "displayDateSeparator": "displayDateSeparator"; "dateSeparatorTextPos": "dateSeparatorTextPos"; }, {}, never, never>;
93
106
  }
@@ -0,0 +1 @@
1
+ export declare const parseDate: (date: Date, format?: 'date' | 'date-time') => string;
package/lib/types.d.ts CHANGED
@@ -236,4 +236,8 @@ export declare type AttachmentContext = {
236
236
  export declare type SystemMessageContext = MessageContext & {
237
237
  parsedDate: string | undefined;
238
238
  };
239
+ export declare type DateSeparatorContext = {
240
+ date: Date;
241
+ parsedDate: string;
242
+ };
239
243
  export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "stream-chat-angular",
3
- "version": "4.30.0",
3
+ "version": "4.31.0",
4
4
  "description": "Angular components to create chat conversations or livestream style chat",
5
5
  "author": "GetStream",
6
6
  "homepage": "https://getstream.io/chat/",
package/public-api.d.ts CHANGED
@@ -17,7 +17,7 @@ export * from './lib/channel-preview/channel-preview.component';
17
17
  export * from './lib/channel-list/channel-list.component';
18
18
  export * from './lib/channel-list/channel-list-toggle.service';
19
19
  export * from './lib/message/message.component';
20
- export * from './lib/message/parse-date';
20
+ export * from './lib/parse-date';
21
21
  export * from './lib/list-users';
22
22
  export * from './lib/message-input/message-input.component';
23
23
  export * from './lib/message-input/textarea/textarea.component';
@@ -51,4 +51,5 @@ export * from './lib/stream-textarea.module';
51
51
  export * from './lib/injection-tokens';
52
52
  export * from './lib/custom-templates.service';
53
53
  export * from './lib/message-reactions.service';
54
+ export * from './lib/date-parser.service';
54
55
  export * from './lib/types';