-
Notifications
You must be signed in to change notification settings - Fork 672
Chat: Add FileUploading types #31352
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
r-farkhutdinov
merged 8 commits into
DevExpress:25_2
from
r-farkhutdinov:25_2_chat_files_types
Oct 21, 2025
Merged
Changes from 1 commit
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
9ef2dac
Chat: Add FileUploading types
8b0db47
Chat: Remove custom field from Attachment & exclude old angular gener…
9797397
d.ts (type for ng smd & docs)
mpreyskurantov 5777183
d.ts (type for ng smd & docs) | regenerate
mpreyskurantov 1e08f95
d.ts -> react: no generic AttachmentDownloadEvent -> fails on Narrowe…
mpreyskurantov 63a61b5
Chat: Add generic attachments
b64d58a
Revert "Chat: Add generic attachments"
460180f
Chat: Add TextMessage's custom fields & fix types issues
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change | ||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -24,10 +24,11 @@ import { | |||||||||||||||||
|
|
||||||||||||||||||
| import DataSource from 'devextreme/data/data_source'; | ||||||||||||||||||
| import dxChat from 'devextreme/ui/chat'; | ||||||||||||||||||
| import { Alert, Message, DisposingEvent, InitializedEvent, MessageDeletedEvent, MessageDeletingEvent, MessageEditCanceledEvent, MessageEditingStartEvent, MessageEnteredEvent, MessageUpdatedEvent, MessageUpdatingEvent, OptionChangedEvent, TypingEndEvent, TypingStartEvent, User } from 'devextreme/ui/chat'; | ||||||||||||||||||
| import { Alert, Message, AttachmentDownloadEvent, DisposingEvent, InitializedEvent, MessageDeletedEvent, MessageDeletingEvent, MessageEditCanceledEvent, MessageEditingStartEvent, MessageEnteredEvent, MessageUpdatedEvent, MessageUpdatingEvent, OptionChangedEvent, TypingEndEvent, TypingStartEvent, User } from 'devextreme/ui/chat'; | ||||||||||||||||||
| import { DataSourceOptions } from 'devextreme/data/data_source'; | ||||||||||||||||||
| import { Store } from 'devextreme/data/store'; | ||||||||||||||||||
| import { Format } from 'devextreme/common/core/localization'; | ||||||||||||||||||
| import { dxFileUploaderOptions } from 'devextreme/ui/file_uploader'; | ||||||||||||||||||
|
|
||||||||||||||||||
| import DxChat from 'devextreme/ui/chat'; | ||||||||||||||||||
|
|
||||||||||||||||||
|
|
@@ -46,22 +47,27 @@ import { | |||||||||||||||||
| import { DxiAlertModule } from 'devextreme-angular/ui/nested'; | ||||||||||||||||||
| import { DxoDayHeaderFormatModule } from 'devextreme-angular/ui/nested'; | ||||||||||||||||||
| import { DxoEditingModule } from 'devextreme-angular/ui/nested'; | ||||||||||||||||||
| import { DxoFileUploaderOptionsModule } from 'devextreme-angular/ui/nested'; | ||||||||||||||||||
| import { DxiItemModule } from 'devextreme-angular/ui/nested'; | ||||||||||||||||||
| import { DxiAttachmentModule } from 'devextreme-angular/ui/nested'; | ||||||||||||||||||
| import { DxoAuthorModule } from 'devextreme-angular/ui/nested'; | ||||||||||||||||||
| import { DxoMessageTimestampFormatModule } from 'devextreme-angular/ui/nested'; | ||||||||||||||||||
| import { DxiTypingUserModule } from 'devextreme-angular/ui/nested'; | ||||||||||||||||||
| import { DxoUserModule } from 'devextreme-angular/ui/nested'; | ||||||||||||||||||
|
|
||||||||||||||||||
| import { DxiChatAlertModule } from 'devextreme-angular/ui/chat/nested'; | ||||||||||||||||||
| import { DxiChatAttachmentModule } from 'devextreme-angular/ui/chat/nested'; | ||||||||||||||||||
| import { DxoChatAuthorModule } from 'devextreme-angular/ui/chat/nested'; | ||||||||||||||||||
| import { DxoChatDayHeaderFormatModule } from 'devextreme-angular/ui/chat/nested'; | ||||||||||||||||||
| import { DxoChatEditingModule } from 'devextreme-angular/ui/chat/nested'; | ||||||||||||||||||
| import { DxoChatFileUploaderOptionsModule } from 'devextreme-angular/ui/chat/nested'; | ||||||||||||||||||
| import { DxiChatItemModule } from 'devextreme-angular/ui/chat/nested'; | ||||||||||||||||||
| import { DxoChatMessageTimestampFormatModule } from 'devextreme-angular/ui/chat/nested'; | ||||||||||||||||||
| import { DxiChatTypingUserModule } from 'devextreme-angular/ui/chat/nested'; | ||||||||||||||||||
| import { DxoChatUserModule } from 'devextreme-angular/ui/chat/nested'; | ||||||||||||||||||
| import { | ||||||||||||||||||
| PROPERTY_TOKEN_alerts, | ||||||||||||||||||
| PROPERTY_TOKEN_attachments, | ||||||||||||||||||
| PROPERTY_TOKEN_items, | ||||||||||||||||||
| PROPERTY_TOKEN_typingUsers, | ||||||||||||||||||
| } from 'devextreme-angular/core/tokens'; | ||||||||||||||||||
|
|
@@ -91,6 +97,11 @@ export class DxChatComponent extends DxComponent implements OnDestroy, OnChanges | |||||||||||||||||
| this.setChildren('alerts', value); | ||||||||||||||||||
| } | ||||||||||||||||||
|
|
||||||||||||||||||
| @ContentChildren(PROPERTY_TOKEN_attachments) | ||||||||||||||||||
| set _attachmentsContentChildren(value: QueryList<CollectionNestedOption>) { | ||||||||||||||||||
| this.setChildren('attachments', value); | ||||||||||||||||||
| } | ||||||||||||||||||
|
|
||||||||||||||||||
| @ContentChildren(PROPERTY_TOKEN_items) | ||||||||||||||||||
| set _itemsContentChildren(value: QueryList<CollectionNestedOption>) { | ||||||||||||||||||
| this.setChildren('items', value); | ||||||||||||||||||
|
|
@@ -220,6 +231,19 @@ export class DxChatComponent extends DxComponent implements OnDestroy, OnChanges | |||||||||||||||||
| } | ||||||||||||||||||
|
|
||||||||||||||||||
|
|
||||||||||||||||||
| /** | ||||||||||||||||||
| * [descr:dxChatOptions.fileUploaderOptions] | ||||||||||||||||||
|
|
||||||||||||||||||
| */ | ||||||||||||||||||
| @Input() | ||||||||||||||||||
| get fileUploaderOptions(): dxFileUploaderOptions { | ||||||||||||||||||
| return this._getOption('fileUploaderOptions'); | ||||||||||||||||||
| } | ||||||||||||||||||
| set fileUploaderOptions(value: dxFileUploaderOptions) { | ||||||||||||||||||
| this._setOption('fileUploaderOptions', value); | ||||||||||||||||||
| } | ||||||||||||||||||
|
|
||||||||||||||||||
|
|
||||||||||||||||||
| /** | ||||||||||||||||||
| * [descr:dxChatOptions.focusStateEnabled] | ||||||||||||||||||
|
|
||||||||||||||||||
|
|
@@ -440,6 +464,14 @@ export class DxChatComponent extends DxComponent implements OnDestroy, OnChanges | |||||||||||||||||
| this._setOption('width', value); | ||||||||||||||||||
| } | ||||||||||||||||||
|
|
||||||||||||||||||
| /** | ||||||||||||||||||
|
|
||||||||||||||||||
| * [descr:dxChatOptions.onAttachmentDownload] | ||||||||||||||||||
|
|
||||||||||||||||||
|
|
||||||||||||||||||
|
marker-dao marked this conversation as resolved.
Comment on lines
+463
to
+466
|
||||||||||||||||||
| * [descr:undefined] | |
| * Fires when a user attempts to download an attachment from a chat message. | |
| * Use this event to handle or intercept attachment downloads, for example to log downloads, | |
| * implement custom download logic, or restrict access to certain files. | |
| * The event provides information about the attachment and the message it belongs to. |
84 changes: 84 additions & 0 deletions
84
packages/devextreme-angular/src/ui/chat/nested/attachment-dxi.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,84 @@ | ||
| /* tslint:disable:max-line-length */ | ||
|
|
||
|
|
||
| import { | ||
| Component, | ||
| NgModule, | ||
| Host, | ||
| SkipSelf, | ||
| Input | ||
| } from '@angular/core'; | ||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
| import { | ||
| DxIntegrationModule, | ||
| NestedOptionHost, | ||
| } from 'devextreme-angular/core'; | ||
| import { CollectionNestedOption } from 'devextreme-angular/core'; | ||
|
|
||
| import { PROPERTY_TOKEN_attachments } from 'devextreme-angular/core/tokens'; | ||
|
|
||
| @Component({ | ||
| selector: 'dxi-chat-attachment', | ||
| standalone: true, | ||
| template: '', | ||
| styles: [''], | ||
| imports: [ DxIntegrationModule ], | ||
| providers: [ | ||
| NestedOptionHost, | ||
| { | ||
| provide: PROPERTY_TOKEN_attachments, | ||
| useExisting: DxiChatAttachmentComponent, | ||
| } | ||
| ] | ||
| }) | ||
| export class DxiChatAttachmentComponent extends CollectionNestedOption { | ||
| @Input() | ||
| get name(): string { | ||
| return this._getOption('name'); | ||
| } | ||
| set name(value: string) { | ||
| this._setOption('name', value); | ||
| } | ||
|
|
||
| @Input() | ||
| get size(): number { | ||
| return this._getOption('size'); | ||
| } | ||
| set size(value: number) { | ||
| this._setOption('size', value); | ||
| } | ||
|
|
||
|
|
||
| protected get _optionPath() { | ||
| return 'attachments'; | ||
| } | ||
|
|
||
|
|
||
| constructor(@SkipSelf() @Host() parentOptionHost: NestedOptionHost, | ||
| @Host() optionHost: NestedOptionHost) { | ||
| super(); | ||
| parentOptionHost.setNestedOption(this); | ||
| optionHost.setHost(this, this._fullOptionPath.bind(this)); | ||
| } | ||
|
|
||
|
|
||
|
|
||
| ngOnDestroy() { | ||
| this._deleteRemovedOptions(this._fullOptionPath()); | ||
| } | ||
|
|
||
| } | ||
|
|
||
| @NgModule({ | ||
| imports: [ | ||
| DxiChatAttachmentComponent | ||
| ], | ||
| exports: [ | ||
| DxiChatAttachmentComponent | ||
| ], | ||
| }) | ||
| export class DxiChatAttachmentModule { } |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The
@ContentChildrendecorator forPROPERTY_TOKEN_attachmentsis set at the Chat component level, but attachments are actually nested within Item components according to the nested component structure (see item-dxi.ts lines 45-48). This decorator may not function correctly at this level and could lead to incorrect attachment binding. Consider removing this decorator from the Chat component since attachments are already properly handled within the Item nested component.