Skip to content

Commit 6cf2481

Browse files
author
Ruslan Farkhutdinov
committed
Chat FU: Add display flex to message bubble & refactor
1 parent 0e85dea commit 6cf2481

File tree

12 files changed

+42
-18
lines changed

12 files changed

+42
-18
lines changed

packages/devextreme-scss/scss/widgets/base/chat/layout/chat-fileview/_mixins.scss

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,12 +49,10 @@
4949

5050
@mixin chat-fileview(
5151
$chat-file-view-items-gap,
52-
$chat-file-view-margin-top,
5352
$chat-file-container-width,
5453
) {
5554
.dx-chat-file-view {
5655
gap: $chat-file-view-items-gap;
57-
margin-top: $chat-file-view-margin-top;
5856
grid-template-columns: repeat(auto-fit, $chat-file-container-width);
5957
}
6058
}

packages/devextreme-scss/scss/widgets/base/chat/layout/chat-messagebubble/_index.scss

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ $chat-messagebubble-max-height-image: 400px !default;
99
}
1010

1111
.dx-chat-messagebubble {
12+
display: flex;
13+
flex-direction: column;
1214
width: auto;
1315
word-break: break-word;
1416
white-space: break-spaces;

packages/devextreme-scss/scss/widgets/base/chat/layout/chat-messagebubble/_mixins.scss

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
$bubble-container-gap,
99
$bubble-delete-gap,
1010
$bubble-delete-icon-size,
11+
$bubble-gap,
1112
) {
1213
.dx-chat-messagegroup-content {
1314
row-gap: $bubble-container-gap;
@@ -16,6 +17,7 @@
1617
.dx-chat-messagebubble {
1718
padding: $padding;
1819
border-radius: $border-radius;
20+
gap: $bubble-gap;
1921

2022
&.dx-chat-messagebubble-deleted {
2123
.dx-chat-messagebubble-content {

packages/devextreme-scss/scss/widgets/fluent/chat/_index.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@
3030
);
3131
@include chat-fileview(
3232
$chat-file-view-items-gap,
33-
$chat-file-view-margin-top,
3433
$chat-file-container-width,
3534
);
3635
@include chat-alertlist(
@@ -58,6 +57,7 @@
5857
$chat-bubble-container-gap,
5958
$chat-bubble-delete-gap,
6059
$chat-bubble-delete-icon-size,
60+
$bubble-gap,
6161
);
6262
@include chat-messagegroup(
6363
$chat-messagegroup-gap,

packages/devextreme-scss/scss/widgets/fluent/chat/_sizes.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ $chat-file-secondary-font-size: 10px !default;
7474
$chat-file-base-section-gap: 4px !default;
7575
$chat-file-file-size-max-width: 4em !default;
7676
$chat-file-view-items-gap: 8px !default;
77-
$chat-file-view-margin-top: 8px !default;
77+
$bubble-gap: 8px !default;
7878

7979
@if $size == "default" {
8080
$chat-bubble-border-radius: $fluent-base-border-radius * 3 !default;

packages/devextreme-scss/scss/widgets/generic/chat/_index.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@
3333
);
3434
@include chat-fileview(
3535
$chat-file-view-items-gap,
36-
$chat-file-view-margin-top,
3736
$chat-file-container-width,
3837
);
3938
@include chat-alertlist(
@@ -61,6 +60,7 @@
6160
$chat-bubble-container-gap,
6261
$chat-bubble-delete-gap,
6362
$chat-bubble-delete-icon-size,
63+
$bubble-gap,
6464
);
6565
@include chat-messagegroup(
6666
$chat-messagegroup-gap,

packages/devextreme-scss/scss/widgets/generic/chat/_sizes.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ $chat-file-secondary-font-size: 10px !default;
7373
$chat-file-base-section-gap: 4px !default;
7474
$chat-file-file-size-max-width: 4em !default;
7575
$chat-file-view-items-gap: 8px !default;
76-
$chat-file-view-margin-top: 8px !default;
76+
$bubble-gap: 8px !default;
7777

7878
@if $size == "default" {
7979
$chat-bubble-padding: 8px 12px !default;

packages/devextreme-scss/scss/widgets/material/chat/_index.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@
3131
);
3232
@include chat-fileview(
3333
$chat-file-view-items-gap,
34-
$chat-file-view-margin-top,
3534
$chat-file-container-width,
3635
);
3736
@include chat-alertlist(
@@ -59,6 +58,7 @@
5958
$chat-bubble-container-gap,
6059
$chat-bubble-delete-gap,
6160
$chat-bubble-delete-icon-size,
61+
$bubble-gap,
6262
);
6363
@include chat-messagegroup(
6464
$chat-messagegroup-gap,

packages/devextreme-scss/scss/widgets/material/chat/_sizes.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ $chat-file-secondary-font-size: 10px !default;
7171
$chat-file-base-section-gap: 4px !default;
7272
$chat-file-file-size-max-width: 4em !default;
7373
$chat-file-view-items-gap: 8px !default;
74-
$chat-file-view-margin-top: 8px !default;
74+
$bubble-gap: 8px !default;
7575

7676
@if $size == "default" {
7777
$chat-bubble-border-radius: 8px !default;

packages/devextreme/js/__internal/ui/chat/messagebubble.ts

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,7 @@ import type { WidgetOptions } from '@js/ui/widget/ui.widget';
77
import { ICON_CLASS } from '@ts/core/utils/m_icon';
88
import type { OptionChanged } from '@ts/core/widget/types';
99
import Widget from '@ts/core/widget/widget';
10-
11-
import FileView from './file_view/file_view';
10+
import FileView from '@ts/ui/chat/file_view/file_view';
1211

1312
export const CHAT_MESSAGEBUBBLE_CLASS = 'dx-chat-messagebubble';
1413
export const CHAT_MESSAGEBUBBLE_DELETED_CLASS = 'dx-chat-messagebubble-deleted';
@@ -83,8 +82,9 @@ class MessageBubble extends Widget<Properties> {
8382
isDeleted = false,
8483
} = this.option();
8584

86-
this.$element().removeClass(CHAT_MESSAGEBUBBLE_DELETED_CLASS);
87-
this.$element().removeClass(CHAT_MESSAGEBUBBLE_HAS_IMAGE_CLASS);
85+
this.$element()
86+
.removeClass(CHAT_MESSAGEBUBBLE_DELETED_CLASS)
87+
.removeClass(CHAT_MESSAGEBUBBLE_HAS_IMAGE_CLASS);
8888

8989
this._$content.empty();
9090

@@ -143,11 +143,11 @@ class MessageBubble extends Widget<Properties> {
143143
if (attachments?.length && !isDeleted) {
144144
const $fileView = $('<div>');
145145
this._createComponent($fileView, FileView, {
146-
files: attachments,
147-
onDownload: onAttachmentDownload,
148146
activeStateEnabled,
149147
focusStateEnabled,
150148
hoverStateEnabled,
149+
files: attachments,
150+
onDownload: onAttachmentDownload,
151151
});
152152

153153
this._$attachmentsContainer.append($fileView);
@@ -173,6 +173,7 @@ class MessageBubble extends Widget<Properties> {
173173
this._updateContent();
174174
this._renderAttachments();
175175
break;
176+
case 'type':
176177
case 'template':
177178
this._updateContent();
178179
break;

0 commit comments

Comments
 (0)