-
Notifications
You must be signed in to change notification settings - Fork 664
Chat: Integrate Accordion to MessageBubble #32185
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
base: 26_1
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -2,11 +2,14 @@ import messageLocalization from '@js/common/core/localization/message'; | |||||
| import { getPublicElement } from '@js/core/element'; | ||||||
| import type { dxElementWrapper } from '@js/core/renderer'; | ||||||
| import $ from '@js/core/renderer'; | ||||||
| import type { Attachment, AttachmentDownloadClickEvent, Message } from '@js/ui/chat'; | ||||||
| import type { | ||||||
| Attachment, AttachmentDownloadClickEvent, Message, MetaData, | ||||||
| } from '@js/ui/chat'; | ||||||
| import type { WidgetOptions } from '@js/ui/widget/ui.widget'; | ||||||
| import { ICON_CLASS } from '@ts/core/utils/m_icon'; | ||||||
| import type { OptionChanged } from '@ts/core/widget/types'; | ||||||
| import Widget from '@ts/core/widget/widget'; | ||||||
| import Accordion from '@ts/ui/accordion'; | ||||||
| import FileView from '@ts/ui/chat/file_view/file_view'; | ||||||
|
|
||||||
| export const CHAT_MESSAGEBUBBLE_CLASS = 'dx-chat-messagebubble'; | ||||||
|
|
@@ -15,6 +18,7 @@ export const CHAT_MESSAGEBUBBLE_CONTENT_CLASS = 'dx-chat-messagebubble-content'; | |||||
| export const CHAT_MESSAGEBUBBLE_ICON_PROHIBITION_CLASS = `${ICON_CLASS}-cursorprohibition`; | ||||||
| export const CHAT_MESSAGEBUBBLE_HAS_IMAGE_CLASS = 'dx-has-image'; | ||||||
| export const CHAT_MESSAGEBUBBLE_IMAGE_CLASS = 'dx-chat-messagebubble-image'; | ||||||
| export const CHAT_MESSAGEBUBBLE_FUNCTIONCALL_CLASS = 'dx-chat-messagebubble-functioncall'; | ||||||
|
|
||||||
| export const MESSAGE_DATA_KEY = 'dxMessageData'; | ||||||
|
|
||||||
|
|
@@ -26,6 +30,9 @@ export interface Properties extends WidgetOptions<MessageBubble> { | |||||
| src?: string; | ||||||
| alt?: string; | ||||||
| attachments?: Attachment[]; | ||||||
| metadata?: MetaData; | ||||||
| focusStateEnabled?: boolean; | ||||||
| hoverStateEnabled?: boolean; | ||||||
| onAttachmentDownloadClick?: (e: AttachmentDownloadClickEvent) => void; | ||||||
| template?: ((message: Message, container: Element) => void) | null; | ||||||
| } | ||||||
|
|
@@ -35,12 +42,16 @@ class MessageBubble extends Widget<Properties> { | |||||
|
|
||||||
| _$attachments?: dxElementWrapper; | ||||||
|
|
||||||
| _$functionCall?: dxElementWrapper; | ||||||
|
|
||||||
| _getDefaultOptions(): Properties { | ||||||
| return { | ||||||
| ...super._getDefaultOptions(), | ||||||
| isDeleted: false, | ||||||
| isEdited: false, | ||||||
| text: '', | ||||||
| focusStateEnabled: true, | ||||||
| hoverStateEnabled: true, | ||||||
|
Comment on lines
+53
to
+54
|
||||||
| focusStateEnabled: true, | |
| hoverStateEnabled: true, |
marker-dao marked this conversation as resolved.
Show resolved
Hide resolved
Copilot
AI
Jan 14, 2026
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 Accordion component instance is created but not stored as a class property (e.g., this._accordionInstance). This makes it impossible to update the component's options later without re-creating it entirely. Store the instance returned by _createComponent to enable efficient updates when options change.
Copilot
AI
Jan 14, 2026
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.
When focusStateEnabled or hoverStateEnabled options change, the entire function call accordion is re-rendered by calling _renderFunctionCall(). This completely destroys and recreates the Accordion component even when only state options need to be updated. Consider updating the existing Accordion instance's options using this._accordionInstance.option(name, value) instead of full re-rendering for better performance.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -420,6 +420,10 @@ | |
| "dxChat-fileViewLabel": "File list", | ||
| "dxChat-downloadButtonLabel": "Download file {0}", | ||
| "dxChat-fileLimitReachedWarning": "You selected too many files. Select no more than {0} files and retry.", | ||
| "dxChat-functionCallTitle": "function called", | ||
marker-dao marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| "dxChat-functionCallLabel": "Function Called", | ||
| "dxChat-argumentsLabel": "Arguments", | ||
| "dxChat-resultLabel": "Result", | ||
|
|
||
| "dxColorView-ariaRed": "Red", | ||
| "dxColorView-ariaGreen": "Green", | ||
|
|
||
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
focusStateEnabledandhoverStateEnabledproperties are being added to MessageBubble specifically to pass through to the Accordion component. However, these options shadow the inheritedfocusStateEnabledandhoverStateEnabledfrom the parent Widget class. This creates ambiguity: MessageBubble is a Widget that has its own focus/hover states, but these properties are being used exclusively for the nested Accordion. Consider using namespaced properties likeaccordionFocusStateEnabledandaccordionHoverStateEnabledto avoid confusion and maintain clear separation between the MessageBubble's state and the Accordion's state.