Skip to content

Commit c68fe77

Browse files
authored
Merge pull request #672 from GetStream/custom-autocompletes
feat: custom autocompletes
2 parents 6ab7009 + 5c2be09 commit c68fe77

31 files changed

+313
-152
lines changed

README.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,13 @@ Check out our current openings and apply via [Stream's website](https://getstrea
5252

5353
### Install with NPM
5454

55+
Run this command if you are using **Angular 19**:
56+
57+
```shell
58+
# Some SDK depedencies doesn't yet have official support for Angular 19, so we need to add --force flag until then
59+
npm install stream-chat-angular stream-chat @ngx-translate/core@15 ngx-float-ui@18 --force
60+
```
61+
5562
Supported Angular versions: **Angular 15-18**
5663

5764
Run this command if you are using **Angular 18**:

copy-generated-component-docs.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -62,19 +62,19 @@ fs.readdir(generatedDocsPath, (err: any, files: string[]) => {
6262
const propertiesContent = extractProperties(generatedFileContent);
6363

6464
fs.readFile(
65-
`${componentDocsPath}/${file}x`,
65+
`${componentDocsPath}/${file}`,
6666
'utf8',
6767
(err: any, docFile: any) => {
6868
if (err)
6969
throw new Error(
70-
`${componentDocsPath}/${file}x couldn't be opened, error: ${err}, make sure that this file exists`
70+
`${componentDocsPath}/${file} couldn't be opened, error: ${err}, make sure that this file exists`
7171
);
7272

7373
if (file !== '_category_.json') {
7474
const result = insertGeneratedParts(docFile, propertiesContent);
7575

7676
fs.writeFile(
77-
`${componentDocsPath}/${file}x`,
77+
`${componentDocsPath}/${file}`,
7878
result,
7979
'utf8',
8080
(err: any) => {

copy-generated-service-docs.ts

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,18 +31,31 @@ fs.readdir(sourcePath, (err: any, files: string[]) => {
3131
}
3232

3333
// Remove the thre prefix from the title
34-
const result = data
35-
.replace(/# Class:/g, '#')
36-
.replace('<T\\>', '')
37-
.replace('\\', '');
34+
const result =
35+
`---` +
36+
`\n` +
37+
`title: ${file.replace('.md', '')}` +
38+
`\n` +
39+
`slug: /chat/docs/sdk/angular/services/${file.replace('.md', '')}/` +
40+
`\n` +
41+
`---` +
42+
'\n\n' +
43+
data
44+
.replace(`# Class: ${file.replace('.md', '')}`, '')
45+
.replace(
46+
/\b(?!README)(\w+)\.md\b/g,
47+
'/chat/docs/sdk/angular/services/$1'
48+
)
49+
.replace('<T\\>', '')
50+
.replace('\\', '');
3851

3952
fs.writeFile(`${sourcePath}/${file}`, result, 'utf8', (err: any) => {
4053
if (err) {
4154
throw err;
4255
}
4356
fs.copyFile(
4457
`${sourcePath}/${file}`,
45-
`${serviceDocsTargetPath}/${file}x`,
58+
`${serviceDocsTargetPath}/${file}`,
4659
(err: any) => {
4760
if (err) {
4861
throw err;

package.json

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,11 @@
2525
"build:sample-app": "npm run config:prod && ng build --stats-json --project sample-app",
2626
"preanalyze:sample-app": "npm run build:sample-app",
2727
"analyze:sample-app": "webpack-bundle-analyzer dist/sample-app/stats.json",
28-
"copy-css": "rm -rf projects/stream-chat-angular/src/assets/styles && copyfiles --up 5 \"node_modules/@stream-io/stream-chat-css/dist/v2/**/*\" projects/stream-chat-angular/src/assets/styles && copyfiles --up 5 \"node_modules/@stream-io/stream-chat-css/dist/assets/**/*\" projects/stream-chat-angular/src/assets/assets"
28+
"copy-css": "rm -rf projects/stream-chat-angular/src/assets/styles && copyfiles --up 5 \"node_modules/@stream-io/stream-chat-css/dist/v2/**/*\" projects/stream-chat-angular/src/assets/styles && copyfiles --up 5 \"node_modules/@stream-io/stream-chat-css/dist/assets/**/*\" projects/stream-chat-angular/src/assets/assets",
29+
"generate-docs": "npm run typedoc:services && npm run typedoc:components && npm run copy-docs:v5",
30+
"typedoc:services": "typedoc --plugin typedoc-plugin-markdown --plugin typedoc-plugin-reference-excluder --cleanOutputDir true --excludeConstructors true --hideBreadcrumbs true --hideInPageTOC true --excludePrivate true --out temp-service-docs --exclude '!**/*service.ts' --excludeNotDocumented --tsconfig projects/stream-chat-angular/tsconfig.lib.json projects/stream-chat-angular/src/public-api.ts",
31+
"typedoc:components": "typedoc --plugin typedoc-plugin-markdown --plugin typedoc-plugin-reference-excluder --cleanOutputDir true --excludeConstructors true --sort source-order --hideBreadcrumbs true --hideInPageTOC true --excludePrivate true --excludeNotDocumented --out temp-component-docs --exclude '!**/*component.ts' --tsconfig projects/stream-chat-angular/tsconfig.lib.json projects/stream-chat-angular/src/public-api.ts",
32+
"copy-docs:v5": "ts-node copy-generated-service-docs.ts ../docs/data/docs/chat-sdk/angular/v5-latest/06-services & (ts-node remove-generated-component-docs-content ../docs/data/docs/chat-sdk/angular/v5-latest/05-components && ts-node copy-generated-component-docs.ts ../docs/data/docs/chat-sdk/angular/v5-latest/05-components)"
2933
},
3034
"lint-staged": {
3135
"**/*": [

projects/stream-chat-angular/src/lib/attachment.service.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,13 +40,13 @@ export class AttachmentService<
4040
*/
4141
attachmentUploadInProgressCounter$ = new BehaviorSubject<number>(0);
4242
/**
43-
* Emits the state of the uploads ([`AttachmentUpload[]`](https://github.com/GetStream/stream-chat-angular/blob/master/projects/stream-chat-angular/src/lib/types.ts)), it adds a state (`success`, `error` or `uploading`) to each file the user selects for upload. It is used by the [`AttachmentPreviewList`](../components/AttachmentPreviewListComponent.mdx) to display the attachment previews.
43+
* Emits the state of the uploads ([`AttachmentUpload[]`](https://github.com/GetStream/stream-chat-angular/blob/master/projects/stream-chat-angular/src/lib/types.ts)), it adds a state (`success`, `error` or `uploading`) to each file the user selects for upload. It is used by the [`AttachmentPreviewList`](/chat/docs/sdk/angular/components/AttachmentPreviewListComponent/) to display the attachment previews.
4444
*/
4545
attachmentUploads$: Observable<AttachmentUpload[]>;
4646
/**
4747
* You can get and set the list if uploaded custom attachments
4848
*
49-
* By default the SDK components won't display these, but you can provide your own `customAttachmentPreviewListTemplate$` and `customAttachmentListTemplate$` for the [`CustomTemplatesService`](../../services/CustomTemplatesService).
49+
* By default the SDK components won't display these, but you can provide your own `customAttachmentPreviewListTemplate$` and `customAttachmentListTemplate$` for the [`CustomTemplatesService`](/chat/docs/sdk/angular/services/CustomTemplatesService/).
5050
*/
5151
customAttachments$ = new BehaviorSubject<Attachment<T>[]>([]);
5252
/**
@@ -210,7 +210,7 @@ export class AttachmentService<
210210
/**
211211
* You can add custom `image`, `video` and `file` attachments using this method.
212212
*
213-
* Note: If you just want to use your own CDN for file uploads, you don't necessary need this method, you can just specify you own upload function in the [`ChannelService`](./ChannelService.mdx)
213+
* Note: If you just want to use your own CDN for file uploads, you don't necessary need this method, you can just specify you own upload function in the [`ChannelService`](/chat/docs/sdk/angular/services/ChannelService/)
214214
* @param attachment
215215
*/
216216
addAttachment(attachment: Attachment<T>) {

projects/stream-chat-angular/src/lib/avatar-placeholder/avatar-placeholder.component.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import {
99
} from '../types';
1010

1111
/**
12-
* The `AvatarPlaceholder` component displays the [default avatar](./AvatarComponent.mdx) unless a [custom template](../services/CustomTemplatesService.mdx) is provided. This component is used by the SDK internally, you likely won't need to use it.
12+
* The `AvatarPlaceholder` component displays the [default avatar](/chat/docs/sdk/angular/components/AvatarComponent/) unless a [custom template](/chat/docs/sdk/angular/services/CustomTemplatesService/) is provided. This component is used by the SDK internally, you likely won't need to use it.
1313
*/
1414
@Component({
1515
selector: 'stream-avatar-placeholder',

projects/stream-chat-angular/src/lib/channel.service.ts

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ export class ChannelService<
6060
* Emits the currently loaded and [watched](https://getstream.io/chat/docs/javascript/watch_channel/?language=javascript) channel list.
6161
*
6262
* :::important
63-
* If you want to subscribe to channel events, you need to manually reenter Angular's change detection zone, our [Change detection guide](../concepts/change-detection.mdx) explains this in detail.
63+
* If you want to subscribe to channel events, you need to manually reenter Angular's change detection zone, our [Change detection guide](/chat/docs/sdk/angular/concepts/change-detection/) explains this in detail.
6464
* :::
6565
*/
6666
channels$: Observable<Channel<T>[] | undefined>;
@@ -72,7 +72,7 @@ export class ChannelService<
7272
* Emits the currently active channel.
7373
*
7474
* :::important
75-
* If you want to subscribe to channel events, you need to manually reenter Angular's change detection zone, our [Change detection guide](../concepts/change-detection.mdx) explains this in detail.
75+
* If you want to subscribe to channel events, you need to manually reenter Angular's change detection zone, our [Change detection guide](/chat/docs/sdk/angular/concepts/change-detection/) explains this in detail.
7676
* :::
7777
*
7878
* The active channel will always be marked as read when a new message is received
@@ -121,7 +121,7 @@ export class ChannelService<
121121
/**
122122
* If you're using [semantic filters for moderation](https://getstream.io/automated-moderation/docs/automod_configuration/?q=semantic%20filters) you can set up rules for bouncing messages.
123123
*
124-
* If a message is bounced, it will be emitted via this `Observable`. The built-in [`MessageBouncePrompt` component](../../components/MessageBouncePromptComponent) will display the bounce option to the user if a bounced message is clicked.
124+
* If a message is bounced, it will be emitted via this `Observable`. The built-in [`MessageBouncePrompt` component](/chat/docs/sdk/angular/components/MessageBouncePromptComponent/) will display the bounce option to the user if a bounced message is clicked.
125125
*/
126126
bouncedMessage$: BehaviorSubject<StreamMessage<T> | undefined>;
127127
/**
@@ -137,7 +137,7 @@ export class ChannelService<
137137
*/
138138
activeChannelUnreadCount?: number;
139139
/**
140-
* Custom event handler to call if a new message received from a channel that is not being watched, provide an event handler if you want to override the [default channel list ordering](./ChannelService.mdx/#channels)
140+
* Custom event handler to call if a new message received from a channel that is not being watched, provide an event handler if you want to override the [default channel list ordering](/chat/docs/sdk/angular/services/ChannelService/#channels/)
141141
*
142142
* If you're adding a new channel, make sure that it's a [watched](https://getstream.io/chat/docs/javascript/watch_channel/?language=javascript) channel.
143143
*/
@@ -149,7 +149,7 @@ export class ChannelService<
149149
) => void
150150
) => void;
151151
/**
152-
* Custom event handler to call when the user is added to a channel, provide an event handler if you want to override the [default channel list ordering](./ChannelService.mdx/#channels).
152+
* Custom event handler to call when the user is added to a channel, provide an event handler if you want to override the [default channel list ordering](/chat/docs/sdk/angular/services/ChannelService/#channels/).
153153
*
154154
* If you're adding a new channel, make sure that it's a [watched](https://getstream.io/chat/docs/javascript/watch_channel/?language=javascript) channel.
155155
*/
@@ -161,7 +161,7 @@ export class ChannelService<
161161
) => void
162162
) => void;
163163
/**
164-
* Custom event handler to call when the user is removed from a channel, provide an event handler if you want to override the [default channel list ordering](./ChannelService.mdx/#channels).
164+
* Custom event handler to call when the user is removed from a channel, provide an event handler if you want to override the [default channel list ordering](/chat/docs/sdk/angular/services/ChannelService/#channels/).
165165
*
166166
* If you're adding a new channel, make sure that it's a [watched](https://getstream.io/chat/docs/javascript/watch_channel/?language=javascript) channel.
167167
*/
@@ -173,7 +173,7 @@ export class ChannelService<
173173
) => void
174174
) => void;
175175
/**
176-
* Custom event handler to call when a channel is deleted, provide an event handler if you want to override the [default channel list ordering](./ChannelService.mdx/#channels).
176+
* Custom event handler to call when a channel is deleted, provide an event handler if you want to override the [default channel list ordering](/chat/docs/sdk/angular/services/ChannelService/#channels/).
177177
*
178178
* If you're adding a new channel, make sure that it's a [watched](https://getstream.io/chat/docs/javascript/watch_channel/?language=javascript) channel.
179179
*/
@@ -189,7 +189,7 @@ export class ChannelService<
189189
parentMessageSetter: (message: StreamMessage<T> | undefined) => void
190190
) => void;
191191
/**
192-
* Custom event handler to call when a channel is updated, provide an event handler if you want to override the [default channel list ordering](./ChannelService.mdx/#channels).
192+
* Custom event handler to call when a channel is updated, provide an event handler if you want to override the [default channel list ordering](/chat/docs/sdk/angular/services/ChannelService/#channels/).
193193
*
194194
* If you're adding a new channel, make sure that it's a [watched](https://getstream.io/chat/docs/javascript/watch_channel/?language=javascript) channel.
195195
*/
@@ -205,7 +205,7 @@ export class ChannelService<
205205
parentMessageSetter: (message: StreamMessage | undefined) => void
206206
) => void;
207207
/**
208-
* Custom event handler to call when a channel is truncated, provide an event handler if you want to override the [default channel list ordering](./ChannelService.mdx/#channels).
208+
* Custom event handler to call when a channel is truncated, provide an event handler if you want to override the [default channel list ordering](/chat/docs/sdk/angular/services/ChannelService/#channels/).
209209
*
210210
* If you're adding a new channel, make sure that it's a [watched](https://getstream.io/chat/docs/javascript/watch_channel/?language=javascript) channel.
211211
*/
@@ -221,7 +221,7 @@ export class ChannelService<
221221
parentMessageSetter: (message: StreamMessage<T> | undefined) => void
222222
) => void;
223223
/**
224-
* Custom event handler to call when a channel becomes hidden, provide an event handler if you want to override the [default channel list ordering](./ChannelService.mdx/#channels).
224+
* Custom event handler to call when a channel becomes hidden, provide an event handler if you want to override the [default channel list ordering](/chat/docs/sdk/angular/services/ChannelService/#channels/).
225225
*
226226
* If you're adding a new channel, make sure that it's a [watched](https://getstream.io/chat/docs/javascript/watch_channel/?language=javascript) channel.
227227
*/
@@ -237,7 +237,7 @@ export class ChannelService<
237237
parentMessageSetter: (message: StreamMessage<T> | undefined) => void
238238
) => void;
239239
/**
240-
* Custom event handler to call when a channel becomes visible, provide an event handler if you want to override the [default channel list ordering](./ChannelService.mdx/#channels).
240+
* Custom event handler to call when a channel becomes visible, provide an event handler if you want to override the [default channel list ordering](/chat/docs/sdk/angular/services/ChannelService/#channels/).
241241
*
242242
* If you're adding a new channel, make sure that it's a [watched](https://getstream.io/chat/docs/javascript/watch_channel/?language=javascript) channel.
243243
*/
@@ -253,7 +253,7 @@ export class ChannelService<
253253
parentMessageSetter: (message: StreamMessage<T> | undefined) => void
254254
) => void;
255255
/**
256-
* Custom event handler to call if a new message received from a channel that is being watched, provide an event handler if you want to override the [default channel list ordering](./ChannelService.mdx/#channels).
256+
* Custom event handler to call if a new message received from a channel that is being watched, provide an event handler if you want to override the [default channel list ordering](/chat/docs/sdk/angular/services/ChannelService/#channels/).
257257
*
258258
* If you're adding a new channel, make sure that it's a [watched](https://getstream.io/chat/docs/javascript/watch_channel/?language=javascript) channel.
259259
*/
@@ -775,7 +775,7 @@ export class ChannelService<
775775
}
776776

777777
/**
778-
* Resets the `activeChannel$`, `channels$` and `activeChannelMessages$` Observables. Useful when disconnecting a chat user, use in combination with [`disconnectUser`](./ChatClientService.mdx/#disconnectuser).
778+
* Resets the `activeChannel$`, `channels$` and `activeChannelMessages$` Observables. Useful when disconnecting a chat user, use in combination with [`disconnectUser`](/chat/docs/sdk/angular/services/ChatClientService/#disconnectuser/).
779779
*/
780780
reset() {
781781
this.deselectActiveChannel();
@@ -961,7 +961,7 @@ export class ChannelService<
961961

962962
/**
963963
* Uploads files to the channel. If you want to know more about [file uploads](https://getstream.io/chat/docs/javascript/file_uploads/?language=javascript) check out the platform documentation.
964-
* @param uploads the attachments to upload (output of the [`AttachmentService`](./AttachmentService.mdx))
964+
* @param uploads the attachments to upload (output of the [`AttachmentService`](/chat/docs/sdk/angular/services/AttachmentService/))
965965
* @returns the result of file upload requests
966966
*/
967967
async uploadAttachments(
@@ -1042,7 +1042,7 @@ export class ChannelService<
10421042

10431043
/**
10441044
* Deletes an uploaded file by URL. If you want to know more about [file uploads](https://getstream.io/chat/docs/javascript/file_uploads/?language=javascript) check out the platform documentation
1045-
* @param attachmentUpload Attachment to be deleted (output of the [`AttachmentService`](./AttachmentService.mdx))
1045+
* @param attachmentUpload Attachment to be deleted (output of the [`AttachmentService`](/chat/docs/sdk/angular/services/AttachmentService/))
10461046
*/
10471047
async deleteAttachment(attachmentUpload: AttachmentUpload) {
10481048
const channel = this.activeChannelSubject.getValue()!;

projects/stream-chat-angular/src/lib/channel/channel.component.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import { ThemeService } from '../theme.service';
66
import { CustomTemplatesService } from '../custom-templates.service';
77

88
/**
9-
* The `Channel` component is a container component that displays the [`ChannelHeader`](./ChannelHeaderComponent.mdx), [`MessageList`](./MessageListComponent.mdx), [`NotificationList`](./NotificationListComponent.mdx) and [`MessageInput`](./MessageInputComponent.mdx) components. You can also provide the [`Thread`](./ThreadComponent.mdx) component to use message [threads](https://getstream.io/chat/docs/javascript/threads/?language=javascript).
9+
* The `Channel` component is a container component that displays the [`ChannelHeader`](/chat/docs/sdk/angular/components/ChannelHeaderComponent/), [`MessageList`](/chat/docs/sdk/angular/components/MessageListComponent), [`NotificationList`](/chat/docs/sdk/angular/components/NotificationListComponent/) and [`MessageInput`](/chat/docs/sdk/angular/components/MessageInputComponent/) components. You can also provide the [`Thread`](/chat/docs/sdk/angular/components/ThreadComponent/) component to use message [threads](https://getstream.io/chat/docs/javascript/threads/?language=javascript).
1010
*/
1111
@Component({
1212
selector: 'stream-channel',

0 commit comments

Comments
 (0)