stream-chat-angular 4.21.0 → 4.23.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.
@@ -1,6 +1,6 @@
1
- import { EventEmitter, OnChanges, SimpleChanges } from '@angular/core';
1
+ import { EventEmitter, OnChanges, OnDestroy, OnInit, SimpleChanges, TemplateRef } from '@angular/core';
2
2
  import { Action, Attachment } from 'stream-chat';
3
- import { ModalContext, DefaultStreamChatGenerics, AttachmentConfigration, VideoAttachmentConfiguration, ImageAttachmentConfiguration } from '../types';
3
+ import { ModalContext, DefaultStreamChatGenerics, AttachmentConfigration, VideoAttachmentConfiguration, ImageAttachmentConfiguration, AttachmentContext } from '../types';
4
4
  import { ChannelService } from '../channel.service';
5
5
  import { CustomTemplatesService } from '../custom-templates.service';
6
6
  import { AttachmentConfigurationService } from '../attachment-configuration.service';
@@ -9,7 +9,7 @@ import * as i0 from "@angular/core";
9
9
  /**
10
10
  * The `AttachmentList` component displays the attachments of a message
11
11
  */
12
- export declare class AttachmentListComponent implements OnChanges {
12
+ export declare class AttachmentListComponent implements OnChanges, OnInit, OnDestroy {
13
13
  readonly customTemplatesService: CustomTemplatesService;
14
14
  private channelService;
15
15
  private attachmentConfigurationService;
@@ -34,10 +34,19 @@ export declare class AttachmentListComponent implements OnChanges {
34
34
  imagesToView: Attachment<DefaultStreamChatGenerics>[];
35
35
  imagesToViewCurrentIndex: number;
36
36
  themeVersion: '1' | '2';
37
+ imageAttachmentTemplate?: TemplateRef<AttachmentContext>;
38
+ videoAttachmentTemplate?: TemplateRef<AttachmentContext>;
39
+ galleryAttachmentTemplate?: TemplateRef<AttachmentContext>;
40
+ fileAttachmentTemplate?: TemplateRef<AttachmentContext>;
41
+ cardAttachmentTemplate?: TemplateRef<AttachmentContext>;
42
+ attachmentActionsTemplate?: TemplateRef<AttachmentContext>;
37
43
  private modalContent;
38
44
  private attachmentConfigurations;
45
+ private subscriptions;
39
46
  constructor(customTemplatesService: CustomTemplatesService, channelService: ChannelService, attachmentConfigurationService: AttachmentConfigurationService, themeService: ThemeService);
47
+ ngOnInit(): void;
40
48
  ngOnChanges(changes: SimpleChanges): void;
49
+ ngOnDestroy(): void;
41
50
  trackByUrl(_: number, attachment: Attachment): unknown;
42
51
  isImage(attachment: Attachment): boolean;
43
52
  isSvg(attachment: Attachment): boolean;
@@ -54,6 +63,7 @@ export declare class AttachmentListComponent implements OnChanges {
54
63
  openImageModal(attachments: Attachment[], selectedIndex?: number): void;
55
64
  stepImages(dir: -1 | 1): void;
56
65
  trackByImageUrl(_: number, item: Attachment): unknown;
66
+ getAttachmentContext(attachment: Attachment<DefaultStreamChatGenerics>): AttachmentContext;
57
67
  getImageAttachmentConfiguration(attachment: Attachment, type: 'gallery' | 'single', element: HTMLElement): ImageAttachmentConfiguration;
58
68
  getCarouselImageAttachmentConfiguration(attachment: Attachment, element: HTMLElement): ImageAttachmentConfiguration;
59
69
  getVideoAttachmentConfiguration(attachment: Attachment, element: HTMLElement): VideoAttachmentConfiguration;
@@ -1,6 +1,6 @@
1
1
  import { TemplateRef } from '@angular/core';
2
2
  import { BehaviorSubject } from 'rxjs';
3
- import { AttachmentListContext, AttachmentPreviewListContext, AvatarContext, ChannelActionsContext, ChannelHeaderInfoContext, ChannelPreviewContext, CommandAutocompleteListItemContext, CustomAttachmentUploadContext, DeliveredStatusContext, EmojiPickerContext, IconContext, LoadingIndicatorContext, MentionAutcompleteListItemContext, MentionTemplateContext, MessageActionBoxItemContext, MessageActionsBoxContext, MessageContext, MessageInputContext, MessageReactionsContext, ModalContext, NotificationContext, ReadStatusContext, SendingStatusContext, ThreadHeaderContext, TypingIndicatorContext } from './types';
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, 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.
@@ -156,6 +156,30 @@ export declare class CustomTemplatesService {
156
156
  * For code examples to the different customizations see our [customizations example application](https://github.com/GetStream/stream-chat-angular/tree/master/projects/customizations-example), specifically the [AppComponent](https://github.com/GetStream/stream-chat-angular/tree/master/projects/customizations-example/src/app) (see [README](https://github.com/GetStream/stream-chat-angular/blob/master/README.md#customization-examples) for instructions on how to start the application).
157
157
  */
158
158
  customAttachmentUploadTemplate$: BehaviorSubject<TemplateRef<CustomAttachmentUploadContext> | undefined>;
159
+ /**
160
+ * The template that can be used to override how a single image attachment is displayed inside the [attachment list](../components/AttachmentListComponent.mdx)
161
+ */
162
+ imageAttachmentTemplate$: BehaviorSubject<TemplateRef<AttachmentContext> | undefined>;
163
+ /**
164
+ * The template that can be used to override how a video attachment is displayed inside the [attachment list](../components/AttachmentListComponent.mdx)
165
+ */
166
+ videoAttachmentTemplate$: BehaviorSubject<TemplateRef<AttachmentContext> | undefined>;
167
+ /**
168
+ * The template that can be used to override how image gallery is displayed inside the [attachment list](../components/AttachmentListComponent.mdx)
169
+ */
170
+ galleryAttachmentTemplate$: BehaviorSubject<TemplateRef<AttachmentContext> | undefined>;
171
+ /**
172
+ * The template that can be used to override how a file attachment is displayed inside the [attachment list](../components/AttachmentListComponent.mdx)
173
+ */
174
+ fileAttachmentTemplate$: BehaviorSubject<TemplateRef<AttachmentContext> | undefined>;
175
+ /**
176
+ * The template that can be used to override how a card attachment is displayed inside the [attachment list](../components/AttachmentListComponent.mdx)
177
+ */
178
+ cardAttachmentTemplate$: BehaviorSubject<TemplateRef<AttachmentContext> | undefined>;
179
+ /**
180
+ * The template that can be used to override how attachment actions are displayed inside the [attachment list](../components/AttachmentListComponent.mdx)
181
+ */
182
+ attachmentActionsTemplate$: BehaviorSubject<TemplateRef<AttachmentContext> | undefined>;
159
183
  constructor();
160
184
  static ɵfac: i0.ɵɵFactoryDeclaration<CustomTemplatesService, never>;
161
185
  static ɵprov: i0.ɵɵInjectableDeclaration<CustomTemplatesService>;
@@ -27,6 +27,10 @@ export declare class MessageListComponent implements AfterViewChecked, OnChanges
27
27
  */
28
28
  messageOptionsTrigger: 'message-row' | 'message-bubble';
29
29
  typingIndicatorTemplate: TemplateRef<TypingIndicatorContext> | undefined;
30
+ /**
31
+ * You can hide the "jump to latest" button while scrolling. A potential use-case for this input would be to [workaround a known issue on iOS Safar](https://github.com/GetStream/stream-chat-angular/issues/418)
32
+ */
33
+ hideJumpToLatestButtonDuringScroll: boolean;
30
34
  messageTemplate: TemplateRef<MessageContext> | undefined;
31
35
  messages$: Observable<StreamMessage[]>;
32
36
  enabledMessageActions: string[];
@@ -38,6 +42,8 @@ export declare class MessageListComponent implements AfterViewChecked, OnChanges
38
42
  parentMessage: StreamMessage | undefined;
39
43
  highlightedMessageId: string | undefined;
40
44
  isLoading: boolean;
45
+ isScrollInProgress: boolean;
46
+ scrollEndTimeout: any;
41
47
  private scrollContainer;
42
48
  private parentMessageElement;
43
49
  private latestMessage;
@@ -80,5 +86,5 @@ export declare class MessageListComponent implements AfterViewChecked, OnChanges
80
86
  private scrollToLatestMessage;
81
87
  private newMessageReceived;
82
88
  static ɵfac: i0.ɵɵFactoryDeclaration<MessageListComponent, never>;
83
- static ɵcmp: i0.ɵɵComponentDeclaration<MessageListComponent, "stream-message-list", never, { "mode": "mode"; "direction": "direction"; "messageOptionsTrigger": "messageOptionsTrigger"; }, {}, never, never>;
89
+ static ɵcmp: i0.ɵɵComponentDeclaration<MessageListComponent, "stream-message-list", never, { "mode": "mode"; "direction": "direction"; "messageOptionsTrigger": "messageOptionsTrigger"; "hideJumpToLatestButtonDuringScroll": "hideJumpToLatestButtonDuringScroll"; }, {}, never, never>;
84
90
  }
package/lib/types.d.ts CHANGED
@@ -217,3 +217,6 @@ export declare type CustomAttachmentUploadContext = {
217
217
  isMultipleFileUploadEnabled: boolean | undefined;
218
218
  attachmentService: AttachmentService;
219
219
  };
220
+ export declare type AttachmentContext = {
221
+ attachment: Attachment<DefaultStreamChatGenerics>;
222
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "stream-chat-angular",
3
- "version": "4.21.0",
3
+ "version": "4.23.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/",
@@ -1 +1 @@
1
- export const version = '4.21.0';
1
+ export const version = '4.23.0';