@uzum-tech/ui 1.10.1 → 1.11.1

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.
Files changed (91) hide show
  1. package/dist/index.js +1248 -263
  2. package/dist/index.prod.js +3 -3
  3. package/es/_internal/index.d.ts +2 -0
  4. package/es/_internal/index.js +1 -0
  5. package/es/_internal/safe-top-scrollbar/index.d.ts +2 -0
  6. package/es/_internal/safe-top-scrollbar/index.js +1 -0
  7. package/es/_internal/safe-top-scrollbar/src/SafeTopScrollbar.d.ts +356 -0
  8. package/es/_internal/safe-top-scrollbar/src/SafeTopScrollbar.js +708 -0
  9. package/es/_internal/safe-top-scrollbar/src/styles/index.cssr.d.ts +2 -0
  10. package/es/_internal/safe-top-scrollbar/src/styles/index.cssr.js +80 -0
  11. package/es/_internal/safe-top-scrollbar/src/styles/rtl.cssr.d.ts +2 -0
  12. package/es/_internal/safe-top-scrollbar/src/styles/rtl.cssr.js +10 -0
  13. package/es/_internal/safe-top-scrollbar/styles/common.d.ts +7 -0
  14. package/es/_internal/safe-top-scrollbar/styles/common.js +7 -0
  15. package/es/_internal/safe-top-scrollbar/styles/dark.d.ts +3 -0
  16. package/es/_internal/safe-top-scrollbar/styles/dark.js +8 -0
  17. package/es/_internal/safe-top-scrollbar/styles/index.d.ts +4 -0
  18. package/es/_internal/safe-top-scrollbar/styles/index.js +3 -0
  19. package/es/_internal/safe-top-scrollbar/styles/light.d.ts +18 -0
  20. package/es/_internal/safe-top-scrollbar/styles/light.js +12 -0
  21. package/es/_internal/safe-top-scrollbar/styles/rtl.d.ts +3 -0
  22. package/es/_internal/safe-top-scrollbar/styles/rtl.js +6 -0
  23. package/es/chat/src/Chat.d.ts +14 -1
  24. package/es/chat/src/Chat.js +5 -0
  25. package/es/chat/src/ChatParts/ChatAttachment.js +31 -3
  26. package/es/chat/src/ChatParts/MainArea.js +37 -41
  27. package/es/chat/src/interface.d.ts +6 -2
  28. package/es/components.d.ts +1 -0
  29. package/es/components.js +1 -0
  30. package/es/config-provider/src/internal-interface.d.ts +2 -0
  31. package/es/drawer/src/Drawer.d.ts +18 -0
  32. package/es/drawer/src/Drawer.js +28 -26
  33. package/es/drawer/src/DrawerBodyWrapper.d.ts +8 -0
  34. package/es/drawer/src/DrawerBodyWrapper.js +36 -8
  35. package/es/modal-fullscreen/src/ModalFull.d.ts +2 -2
  36. package/es/modal-fullscreen/src/ModalFull.js +31 -24
  37. package/es/modal-fullscreen/src/styles/index.cssr.js +11 -11
  38. package/es/safe-top-scrollbar/index.d.ts +2 -0
  39. package/es/safe-top-scrollbar/index.js +1 -0
  40. package/es/safe-top-scrollbar/src/SafeTopScrollbar.d.ts +177 -0
  41. package/es/safe-top-scrollbar/src/SafeTopScrollbar.js +38 -0
  42. package/es/themes/dark.js +2 -0
  43. package/es/themes/light.js +2 -0
  44. package/es/version.d.ts +1 -1
  45. package/es/version.js +1 -1
  46. package/lib/_internal/index.d.ts +2 -0
  47. package/lib/_internal/index.js +4 -1
  48. package/lib/_internal/safe-top-scrollbar/index.d.ts +2 -0
  49. package/lib/_internal/safe-top-scrollbar/index.js +9 -0
  50. package/lib/_internal/safe-top-scrollbar/src/SafeTopScrollbar.d.ts +356 -0
  51. package/lib/_internal/safe-top-scrollbar/src/SafeTopScrollbar.js +714 -0
  52. package/lib/_internal/safe-top-scrollbar/src/styles/index.cssr.d.ts +2 -0
  53. package/lib/_internal/safe-top-scrollbar/src/styles/index.cssr.js +85 -0
  54. package/lib/_internal/safe-top-scrollbar/src/styles/rtl.cssr.d.ts +2 -0
  55. package/lib/_internal/safe-top-scrollbar/src/styles/rtl.cssr.js +15 -0
  56. package/lib/_internal/safe-top-scrollbar/styles/common.d.ts +7 -0
  57. package/lib/_internal/safe-top-scrollbar/styles/common.js +10 -0
  58. package/lib/_internal/safe-top-scrollbar/styles/dark.d.ts +3 -0
  59. package/lib/_internal/safe-top-scrollbar/styles/dark.js +10 -0
  60. package/lib/_internal/safe-top-scrollbar/styles/index.d.ts +4 -0
  61. package/lib/_internal/safe-top-scrollbar/styles/index.js +12 -0
  62. package/lib/_internal/safe-top-scrollbar/styles/light.d.ts +18 -0
  63. package/lib/_internal/safe-top-scrollbar/styles/light.js +16 -0
  64. package/lib/_internal/safe-top-scrollbar/styles/rtl.d.ts +3 -0
  65. package/lib/_internal/safe-top-scrollbar/styles/rtl.js +12 -0
  66. package/lib/chat/src/Chat.d.ts +14 -1
  67. package/lib/chat/src/Chat.js +5 -0
  68. package/lib/chat/src/ChatParts/ChatAttachment.js +30 -2
  69. package/lib/chat/src/ChatParts/MainArea.js +37 -41
  70. package/lib/chat/src/interface.d.ts +6 -2
  71. package/lib/components.d.ts +1 -0
  72. package/lib/components.js +1 -0
  73. package/lib/config-provider/src/internal-interface.d.ts +2 -0
  74. package/lib/drawer/src/Drawer.d.ts +18 -0
  75. package/lib/drawer/src/Drawer.js +28 -26
  76. package/lib/drawer/src/DrawerBodyWrapper.d.ts +8 -0
  77. package/lib/drawer/src/DrawerBodyWrapper.js +36 -8
  78. package/lib/modal-fullscreen/src/ModalFull.d.ts +2 -2
  79. package/lib/modal-fullscreen/src/ModalFull.js +30 -23
  80. package/lib/modal-fullscreen/src/styles/index.cssr.js +11 -11
  81. package/lib/safe-top-scrollbar/index.d.ts +2 -0
  82. package/lib/safe-top-scrollbar/index.js +9 -0
  83. package/lib/safe-top-scrollbar/src/SafeTopScrollbar.d.ts +177 -0
  84. package/lib/safe-top-scrollbar/src/SafeTopScrollbar.js +41 -0
  85. package/lib/themes/dark.js +5 -0
  86. package/lib/themes/light.js +5 -0
  87. package/lib/version.d.ts +1 -1
  88. package/lib/version.js +1 -1
  89. package/package.json +1 -1
  90. package/volar.d.ts +1 -0
  91. package/web-types.json +58 -2
@@ -0,0 +1,2 @@
1
+ declare const _default: import("css-render").CNode;
2
+ export default _default;
@@ -0,0 +1,85 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ const fade_in_cssr_1 = require("../../../../_styles/transitions/fade-in.cssr");
7
+ const cssr_1 = require("../../../../_utils/cssr");
8
+ // vars:
9
+ // --u-scrollbar-bezier
10
+ // --u-scrollbar-color
11
+ // --u-scrollbar-color-hover
12
+ // --u-scrollbar-width
13
+ // --u-scrollbar-height
14
+ // --u-scrollbar-border-radius
15
+ // --u-scrollbar-rail-inset-horizontal
16
+ // --u-scrollbar-rail-inset-vertical
17
+ // --u-scrollbar-rail-color
18
+ exports.default = (0, cssr_1.cB)('safe-top-scrollbar', `
19
+ overflow: hidden;
20
+ position: relative;
21
+ z-index: auto;
22
+ height: 100%;
23
+ width: 100%;
24
+ `, [(0, cssr_1.c)('>', [(0, cssr_1.cB)('scrollbar-container', `
25
+ width: 100%;
26
+ overflow: scroll;
27
+ height: 100%;
28
+ min-height: inherit;
29
+ max-height: inherit;
30
+ scrollbar-width: none;
31
+ `, [(0, cssr_1.c)('&::-webkit-scrollbar, &::-webkit-scrollbar-track-piece, &::-webkit-scrollbar-thumb', `
32
+ width: 0;
33
+ height: 0;
34
+ display: none;
35
+ `), (0, cssr_1.c)('>', [
36
+ // We can't set overflow hidden since it affects positioning.
37
+ (0, cssr_1.cB)('scrollbar-content', `
38
+ box-sizing: border-box;
39
+ min-width: 100%;
40
+ `)])])]), (0, cssr_1.c)('>, +', [(0, cssr_1.cB)('scrollbar-rail', `
41
+ position: absolute;
42
+ pointer-events: none;
43
+ user-select: none;
44
+ background: var(--u-scrollbar-rail-color);
45
+ -webkit-user-select: none;
46
+ `, [(0, cssr_1.cM)('horizontal', `
47
+ height: var(--u-scrollbar-height);
48
+ `, [(0, cssr_1.c)('>', [(0, cssr_1.cE)('scrollbar', `
49
+ height: var(--u-scrollbar-height);
50
+ border-radius: var(--u-scrollbar-border-radius);
51
+ right: 0;
52
+ `)])]), (0, cssr_1.cM)('horizontal--top', `
53
+ top: var(--u-scrollbar-rail-top-horizontal-top);
54
+ right: var(--u-scrollbar-rail-right-horizontal-top);
55
+ bottom: var(--u-scrollbar-rail-bottom-horizontal-top);
56
+ left: var(--u-scrollbar-rail-left-horizontal-top);
57
+ `), (0, cssr_1.cM)('horizontal--bottom', `
58
+ top: var(--u-scrollbar-rail-top-horizontal-bottom);
59
+ right: var(--u-scrollbar-rail-right-horizontal-bottom);
60
+ bottom: var(--u-scrollbar-rail-bottom-horizontal-bottom);
61
+ left: var(--u-scrollbar-rail-left-horizontal-bottom);
62
+ `), (0, cssr_1.cM)('vertical', `
63
+ width: var(--u-scrollbar-width);
64
+ `, [(0, cssr_1.c)('>', [(0, cssr_1.cE)('scrollbar', `
65
+ width: var(--u-scrollbar-width);
66
+ border-radius: var(--u-scrollbar-border-radius);
67
+ bottom: 0;
68
+ `)])]), (0, cssr_1.cM)('vertical--left', `
69
+ top: var(--u-scrollbar-rail-top-vertical-left);
70
+ right: var(--u-scrollbar-rail-right-vertical-left);
71
+ bottom: var(--u-scrollbar-rail-bottom-vertical-left);
72
+ left: var(--u-scrollbar-rail-left-vertical-left);
73
+ `), (0, cssr_1.cM)('vertical--right', `
74
+ top: var(--u-scrollbar-rail-top-vertical-right);
75
+ right: var(--u-scrollbar-rail-right-vertical-right);
76
+ bottom: var(--u-scrollbar-rail-bottom-vertical-right);
77
+ left: var(--u-scrollbar-rail-left-vertical-right);
78
+ `), (0, cssr_1.cM)('disabled', [(0, cssr_1.c)('>', [(0, cssr_1.cE)('scrollbar', 'pointer-events: none;')])]), (0, cssr_1.c)('>', [(0, cssr_1.cE)('scrollbar', `
79
+ z-index: 1;
80
+ position: absolute;
81
+ cursor: pointer;
82
+ pointer-events: all;
83
+ background-color: var(--u-scrollbar-color);
84
+ transition: background-color .2s var(--u-scrollbar-bezier);
85
+ `, [(0, fade_in_cssr_1.fadeInTransition)(), (0, cssr_1.c)('&:hover', 'background-color: var(--u-scrollbar-color-hover);')])])])])]);
@@ -0,0 +1,2 @@
1
+ declare const _default: import("css-render").CNode;
2
+ export default _default;
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ const cssr_1 = require("../../../../_utils/cssr");
7
+ exports.default = (0, cssr_1.cB)('scrollbar', [(0, cssr_1.cM)('rtl', `
8
+ direction: rtl;
9
+ `, [(0, cssr_1.c)('>', [(0, cssr_1.cB)('scrollbar-rail', [(0, cssr_1.cM)('horizontal', [(0, cssr_1.c)('>', [(0, cssr_1.cE)('scrollbar', `
10
+ left: 0;
11
+ right: unset;
12
+ `)])]), (0, cssr_1.cM)('vertical', `
13
+ left: 4px;
14
+ right: unset;
15
+ `)])])])]);
@@ -0,0 +1,7 @@
1
+ export declare const commonVars: {
2
+ railInsetHorizontalBottom: string;
3
+ railInsetHorizontalTop: string;
4
+ railInsetVerticalRight: string;
5
+ railInsetVerticalLeft: string;
6
+ railColor: string;
7
+ };
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.commonVars = void 0;
4
+ exports.commonVars = {
5
+ railInsetHorizontalBottom: 'auto 2px 4px 2px',
6
+ railInsetHorizontalTop: '4px 2px auto 2px',
7
+ railInsetVerticalRight: '2px 4px 2px auto',
8
+ railInsetVerticalLeft: '2px auto 2px 4px',
9
+ railColor: 'transparent'
10
+ };
@@ -0,0 +1,3 @@
1
+ import type { SafeTopScrollbarTheme } from './light';
2
+ declare const safeTopScrollbarDark: SafeTopScrollbarTheme;
3
+ export default safeTopScrollbarDark;
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const common_1 = require("../../../_styles/common");
4
+ const light_1 = require("./light");
5
+ const safeTopScrollbarDark = {
6
+ name: 'SafeTopScrollbar',
7
+ common: common_1.commonDark,
8
+ self: light_1.self
9
+ };
10
+ exports.default = safeTopScrollbarDark;
@@ -0,0 +1,4 @@
1
+ export { default as scrollbarDark } from './dark';
2
+ export { default as scrollbarLight } from './light';
3
+ export { default as scrollbarRtl } from './rtl';
4
+ export type { SafeTopScrollbarTheme, SafeTopScrollbarThemeVars } from './light';
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.scrollbarRtl = exports.scrollbarLight = exports.scrollbarDark = void 0;
7
+ var dark_1 = require("./dark");
8
+ Object.defineProperty(exports, "scrollbarDark", { enumerable: true, get: function () { return __importDefault(dark_1).default; } });
9
+ var light_1 = require("./light");
10
+ Object.defineProperty(exports, "scrollbarLight", { enumerable: true, get: function () { return __importDefault(light_1).default; } });
11
+ var rtl_1 = require("./rtl");
12
+ Object.defineProperty(exports, "scrollbarRtl", { enumerable: true, get: function () { return __importDefault(rtl_1).default; } });
@@ -0,0 +1,18 @@
1
+ import type { ThemeCommonVars } from '../../../_styles/common';
2
+ import type { Theme } from '../../../_mixins';
3
+ export declare const self: (vars: ThemeCommonVars) => {
4
+ height: string;
5
+ width: string;
6
+ borderRadius: string;
7
+ color: string;
8
+ colorHover: string;
9
+ railInsetHorizontalBottom: string;
10
+ railInsetHorizontalTop: string;
11
+ railInsetVerticalRight: string;
12
+ railInsetVerticalLeft: string;
13
+ railColor: string;
14
+ };
15
+ export type SafeTopScrollbarThemeVars = ReturnType<typeof self>;
16
+ declare const safeTopScrollbarLight: Theme<'SafeTopScrollbar', SafeTopScrollbarThemeVars>;
17
+ export default safeTopScrollbarLight;
18
+ export type SafeTopScrollbarTheme = typeof safeTopScrollbarLight;
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.self = void 0;
4
+ const common_1 = require("../../../_styles/common");
5
+ const common_2 = require("./common");
6
+ const self = (vars) => {
7
+ const { scrollbarColor, scrollbarColorHover, scrollbarHeight, scrollbarWidth, scrollbarBorderRadius } = vars;
8
+ return Object.assign(Object.assign({}, common_2.commonVars), { height: scrollbarHeight, width: scrollbarWidth, borderRadius: scrollbarBorderRadius, color: scrollbarColor, colorHover: scrollbarColorHover });
9
+ };
10
+ exports.self = self;
11
+ const safeTopScrollbarLight = {
12
+ name: 'SafeTopScrollbar',
13
+ common: common_1.commonLight,
14
+ self: exports.self
15
+ };
16
+ exports.default = safeTopScrollbarLight;
@@ -0,0 +1,3 @@
1
+ import type { RtlItem } from '../../../config-provider/src/internal-interface';
2
+ export declare const scrollbarRtl: RtlItem;
3
+ export default scrollbarRtl;
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.scrollbarRtl = void 0;
7
+ const rtl_cssr_1 = __importDefault(require("../src/styles/rtl.cssr"));
8
+ exports.scrollbarRtl = {
9
+ name: 'SafeTopScrollbar',
10
+ style: rtl_cssr_1.default
11
+ };
12
+ exports.default = exports.scrollbarRtl;
@@ -191,6 +191,10 @@ export declare const chatProps: {
191
191
  type: PropType<ChatPropsType["onAttachmentUpload"]>;
192
192
  default: undefined;
193
193
  };
194
+ onAttachmentDownload: {
195
+ type: PropType<ChatPropsType["onAttachmentDownload"]>;
196
+ default: undefined;
197
+ };
194
198
  onFilterChange: {
195
199
  type: PropType<ChatPropsType["onFilterChange"]>;
196
200
  default: undefined;
@@ -2413,6 +2417,10 @@ declare const _default: import("vue").DefineComponent<{
2413
2417
  type: PropType<ChatPropsType["onAttachmentUpload"]>;
2414
2418
  default: undefined;
2415
2419
  };
2420
+ onAttachmentDownload: {
2421
+ type: PropType<ChatPropsType["onAttachmentDownload"]>;
2422
+ default: undefined;
2423
+ };
2416
2424
  onFilterChange: {
2417
2425
  type: PropType<ChatPropsType["onFilterChange"]>;
2418
2426
  default: undefined;
@@ -5652,6 +5660,10 @@ declare const _default: import("vue").DefineComponent<{
5652
5660
  type: PropType<ChatPropsType["onAttachmentUpload"]>;
5653
5661
  default: undefined;
5654
5662
  };
5663
+ onAttachmentDownload: {
5664
+ type: PropType<ChatPropsType["onAttachmentDownload"]>;
5665
+ default: undefined;
5666
+ };
5655
5667
  onFilterChange: {
5656
5668
  type: PropType<ChatPropsType["onFilterChange"]>;
5657
5669
  default: undefined;
@@ -7716,6 +7728,7 @@ declare const _default: import("vue").DefineComponent<{
7716
7728
  onChatItemsScrollToBottom: () => void;
7717
7729
  messages: ChatMessageData[] | undefined;
7718
7730
  onMessageRetry: ((message: ChatMessageData) => void) | undefined;
7731
+ onAttachmentUpload: import("./interface").OnAttachmentUpload | undefined;
7719
7732
  onChatClose: () => void;
7720
7733
  onChatShare: () => void;
7721
7734
  onUserProfile: () => void;
@@ -7749,7 +7762,7 @@ declare const _default: import("vue").DefineComponent<{
7749
7762
  chatItemsLoadingCount: number | undefined;
7750
7763
  messagesLoading: boolean | undefined;
7751
7764
  messagesLoadingCount: number | undefined;
7752
- onAttachmentUpload: import("./interface").OnAttachmentUpload | undefined;
7765
+ onAttachmentDownload: import("./interface").OnAttachmentDownload | undefined;
7753
7766
  onFilterChange: import("./interface").OnFilterChange | undefined;
7754
7767
  onNetworkError: import("./interface").OnNetworkError | undefined;
7755
7768
  onUploadError: import("./interface").OnUploadError | undefined;
@@ -154,6 +154,9 @@ exports.chatProps = Object.assign(Object.assign({}, _mixins_1.useTheme.props), {
154
154
  }, onAttachmentUpload: {
155
155
  type: Function,
156
156
  default: undefined
157
+ }, onAttachmentDownload: {
158
+ type: Function,
159
+ default: undefined
157
160
  }, onFilterChange: {
158
161
  type: Function,
159
162
  default: undefined
@@ -400,6 +403,8 @@ exports.default = (0, vue_1.defineComponent)({
400
403
  handleNetworkError,
401
404
  handleUploadError,
402
405
  handleSendError,
406
+ onAttachmentUpload: (0, vue_1.toRef)(props, 'onAttachmentUpload'),
407
+ onAttachmentDownload: (0, vue_1.toRef)(props, 'onAttachmentDownload'),
403
408
  onChatClose: (0, vue_1.toRef)(props, 'onChatClose'),
404
409
  onChatShare: (0, vue_1.toRef)(props, 'onChatShare'),
405
410
  onUserProfile: (0, vue_1.toRef)(props, 'onUserProfile'),
@@ -1,7 +1,17 @@
1
1
  "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
2
11
  Object.defineProperty(exports, "__esModule", { value: true });
3
12
  const vue_1 = require("vue");
4
13
  const upload_1 = require("../../../upload");
14
+ const interface_1 = require("../interface");
5
15
  exports.default = (0, vue_1.defineComponent)({
6
16
  name: 'ChatAttachment',
7
17
  props: {
@@ -23,10 +33,28 @@ exports.default = (0, vue_1.defineComponent)({
23
33
  }
24
34
  },
25
35
  setup(props, { slots }) {
36
+ const UChat = (0, vue_1.inject)(interface_1.chatInjectionKey, null);
37
+ const onAttachmentDownload = UChat === null || UChat === void 0 ? void 0 : UChat.onAttachmentDownload;
26
38
  const getThumbnailUrl = (attachment) => {
27
39
  const url = [attachment.preview, attachment.thumbnail].find((value) => typeof value === 'string');
28
40
  return url !== null && url !== void 0 ? url : null;
29
41
  };
42
+ const handleDownload = (file) => __awaiter(this, void 0, void 0, function* () {
43
+ if (onAttachmentDownload === null || onAttachmentDownload === void 0 ? void 0 : onAttachmentDownload.value) {
44
+ const attachment = props.attachments.find((att) => att.name === file.name);
45
+ if (attachment) {
46
+ try {
47
+ yield onAttachmentDownload.value(attachment);
48
+ return false;
49
+ }
50
+ catch (error) {
51
+ console.error('Download failed:', error);
52
+ return false;
53
+ }
54
+ }
55
+ }
56
+ return true;
57
+ });
30
58
  const renderAttachment = () => {
31
59
  const fileList = props.attachments.map((attachment, index) => {
32
60
  var _a, _b, _c;
@@ -42,7 +70,7 @@ exports.default = (0, vue_1.defineComponent)({
42
70
  batchId: null
43
71
  });
44
72
  });
45
- const uploadComponent = ((0, vue_1.h)(upload_1.UUpload, Object.assign({ abstract: true, fileList: fileList, fileListStyle: props.withPadding
73
+ const uploadComponent = ((0, vue_1.h)(upload_1.UUpload, Object.assign({ abstract: true }, props.uploadProps, { fileList: fileList, fileListStyle: props.withPadding
46
74
  ? {
47
75
  display: 'flex',
48
76
  flexDirection: 'column',
@@ -51,7 +79,7 @@ exports.default = (0, vue_1.defineComponent)({
51
79
  }
52
80
  : undefined, showRemoveButton: false, showDownloadButton: props.attachments.some((attachment) => attachment.status === 'finished' &&
53
81
  attachment.url &&
54
- attachment.url !== '#'), showRetryButton: props.attachments.some((attachment) => attachment.status === 'error') }, props.uploadProps), {
82
+ attachment.url !== '#'), showRetryButton: props.attachments.some((attachment) => attachment.status === 'error'), onDownload: handleDownload }), {
55
83
  default: () => ((0, vue_1.h)(upload_1.UUploadFileList, null, {
56
84
  'upload-file-title': slots['upload-file-title']
57
85
  ? ({ file }) => { var _a; return (_a = slots['upload-file-title']) === null || _a === void 0 ? void 0 : _a.call(slots, file); }
@@ -17,7 +17,7 @@ const interface_1 = require("../interface");
17
17
  const input_1 = require("../../../input");
18
18
  const button_1 = require("../../../button");
19
19
  const icon_1 = require("../../../icon");
20
- const scrollbar_1 = require("../../../scrollbar");
20
+ const safe_top_scrollbar_1 = require("../../../safe-top-scrollbar");
21
21
  const tooltip_1 = require("../../../tooltip");
22
22
  const upload_1 = require("../../../upload");
23
23
  const flex_1 = require("../../../flex");
@@ -29,13 +29,14 @@ const SENDING_DELAY = 100;
29
29
  exports.default = (0, vue_1.defineComponent)({
30
30
  name: 'ChatMainArea',
31
31
  setup(_, { slots }) {
32
- const { mergedClsPrefixRef, mergedThemeRef, selectedChatRef, messagesRef, typingChatIdsRef, messagesLoadingRef, messagesLoadingCountRef, headerButtonPropsRef, headerIconPropsRef, headerShareButtonPropsRef, headerProfileButtonPropsRef, headerCloseButtonPropsRef, headerShareIconPropsRef, headerProfileIconPropsRef, messageUploadPropsRef, footerInputPropsRef, footerButtonPropsRef, footerUploadPropsRef, footerIconPropsRef, inputPlaceholderRef, retryTextRef, typingTextRef, closeButtonTextRef, shareButtonTooltipRef, profileButtonTooltipRef, unreadNotificationTextRef, notificationsShownSetRef, unreadCountsBeforeReadRef, markNotificationShown, handleMessageSend, handleMessageRetry, handleFooterInputChange, onChatClose, onChatShare, onUserProfile, onMessagesScrollToTop, onMessagesScrollToBottom
32
+ const { mergedClsPrefixRef, mergedThemeRef, selectedChatRef, messagesRef, typingChatIdsRef, messagesLoadingRef, messagesLoadingCountRef, headerButtonPropsRef, headerIconPropsRef, headerShareButtonPropsRef, headerProfileButtonPropsRef, headerCloseButtonPropsRef, headerShareIconPropsRef, headerProfileIconPropsRef, messageUploadPropsRef, footerInputPropsRef, footerButtonPropsRef, footerUploadPropsRef, footerIconPropsRef, inputPlaceholderRef, retryTextRef, typingTextRef, closeButtonTextRef, shareButtonTooltipRef, profileButtonTooltipRef, unreadNotificationTextRef, notificationsShownSetRef, unreadCountsBeforeReadRef, markNotificationShown, handleMessageSend, handleMessageRetry, handleFooterInputChange, onAttachmentUpload, onChatClose, onChatShare, onUserProfile, onMessagesScrollToTop, onMessagesScrollToBottom
33
33
  // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
34
34
  } = (0, vue_1.inject)(interface_1.chatInjectionKey);
35
35
  const messagesBodyRef = (0, vue_1.ref)();
36
36
  const inputRef = (0, vue_1.ref)();
37
37
  const inputValue = (0, vue_1.ref)('');
38
38
  const attachmentFileList = (0, vue_1.ref)([]);
39
+ const uploadedAttachmentsMap = (0, vue_1.ref)(new Map());
39
40
  const lastScrollTop = (0, vue_1.ref)(0);
40
41
  const scrollTopFired = (0, vue_1.ref)(false);
41
42
  const scrollBottomFired = (0, vue_1.ref)(false);
@@ -60,6 +61,8 @@ exports.default = (0, vue_1.defineComponent)({
60
61
  scrollTopFired.value = false;
61
62
  scrollBottomFired.value = false;
62
63
  shouldScrollOnLoad.value = true;
64
+ attachmentFileList.value = [];
65
+ uploadedAttachmentsMap.value.clear();
63
66
  if (unreadBeforeRead > 0 &&
64
67
  !notificationsShownSetRef.value.has(newChat.id)) {
65
68
  hasUnreadMessages.value = true;
@@ -241,7 +244,11 @@ exports.default = (0, vue_1.defineComponent)({
241
244
  const attachments = attachmentFileList.value.length > 0
242
245
  ? attachmentFileList.value.map((file) => {
243
246
  var _a, _b, _c;
244
- return ({
247
+ const uploadedAttachment = uploadedAttachmentsMap.value.get(file.id);
248
+ if (uploadedAttachment) {
249
+ return uploadedAttachment;
250
+ }
251
+ return {
245
252
  id: file.id,
246
253
  type: interface_1.ChatMessageType.FILE,
247
254
  name: file.name,
@@ -251,13 +258,14 @@ exports.default = (0, vue_1.defineComponent)({
251
258
  thumbnail: (_b = file.thumbnailUrl) !== null && _b !== void 0 ? _b : undefined,
252
259
  status: file.status,
253
260
  percentage: (_c = file.percentage) !== null && _c !== void 0 ? _c : undefined
254
- });
261
+ };
255
262
  })
256
263
  : undefined;
257
264
  handleMessageSend(inputValue.value.trim(), attachments);
258
265
  inputValue.value = '';
259
266
  attachmentFileList.value = [];
260
267
  chatInputs.value[selectedChatRef.value.id] = '';
268
+ uploadedAttachmentsMap.value.clear();
261
269
  hasUnreadMessages.value = false;
262
270
  showNotificationManually.value = false;
263
271
  }
@@ -268,39 +276,24 @@ exports.default = (0, vue_1.defineComponent)({
268
276
  }
269
277
  }
270
278
  });
271
- let fileUploadTimer = null;
272
- const pendingFiles = (0, vue_1.ref)([]);
273
279
  const handleFileListUpdate = (fileList) => {
274
- const newFiles = fileList.filter((file) => !attachmentFileList.value.some((existing) => existing.id === file.id) &&
275
- !pendingFiles.value.some((existing) => existing.id === file.id));
276
- if (newFiles.length > 0) {
277
- pendingFiles.value = [...pendingFiles.value, ...newFiles];
278
- if (fileUploadTimer) {
279
- clearTimeout(fileUploadTimer);
280
- }
281
- fileUploadTimer = setTimeout(() => {
282
- if (pendingFiles.value.length > 0 && handleMessageSend) {
283
- const hasError = pendingFiles.value.some((file) => file.status === 'error');
284
- const batchStatus = hasError ? 'error' : 'finished';
285
- const attachments = pendingFiles.value.map((file) => {
286
- var _a, _b, _c;
287
- return ({
288
- id: file.id,
289
- type: interface_1.ChatMessageType.FILE,
290
- name: file.name,
291
- url: file.url ||
292
- (file.file ? URL.createObjectURL(file.file) : '#'),
293
- size: (_a = file.file) === null || _a === void 0 ? void 0 : _a.size,
294
- thumbnail: (_b = file.thumbnailUrl) !== null && _b !== void 0 ? _b : undefined,
295
- status: batchStatus,
296
- percentage: (_c = file.percentage) !== null && _c !== void 0 ? _c : undefined
297
- });
298
- });
299
- handleMessageSend('', attachments);
300
- pendingFiles.value = [];
301
- attachmentFileList.value = [];
280
+ attachmentFileList.value = fileList;
281
+ const uploadCallback = onAttachmentUpload === null || onAttachmentUpload === void 0 ? void 0 : onAttachmentUpload.value;
282
+ if (uploadCallback) {
283
+ const newFiles = fileList.filter((file) => file.file && !uploadedAttachmentsMap.value.has(file.id));
284
+ void (() => __awaiter(this, void 0, void 0, function* () {
285
+ for (const uploadFile of newFiles) {
286
+ if (uploadFile.file) {
287
+ try {
288
+ const attachment = yield uploadCallback(uploadFile.file);
289
+ uploadedAttachmentsMap.value.set(uploadFile.id, attachment);
290
+ }
291
+ catch (error) {
292
+ console.error('File upload failed:', error);
293
+ }
294
+ }
302
295
  }
303
- }, SENDING_DELAY);
296
+ }))();
304
297
  }
305
298
  };
306
299
  const renderFooter = () => {
@@ -309,11 +302,14 @@ exports.default = (0, vue_1.defineComponent)({
309
302
  default: () => ((0, vue_1.h)(flex_1.UFlex, { align: "center", size: "small", class: `${mergedClsPrefixRef.value}-chat-main__input-container` }, {
310
303
  default: () => ((0, vue_1.h)(vue_1.Fragment, null,
311
304
  (0, vue_1.h)(upload_1.UUploadTrigger, { abstract: true }, {
312
- default: ({ handleClick }) => ((0, vue_1.h)(button_1.UButton, Object.assign({ secondary: true, size: "large", class: `${mergedClsPrefixRef.value}-chat-main__attach-btn` }, footerButtonPropsRef.value, { theme: mergedThemeRef.value.peers.Button, themeOverrides: mergedThemeRef.value.peerOverrides.Button, onClick: handleClick }), {
313
- default: () => ((0, vue_1.h)(icon_1.UIcon, Object.assign({ size: 24 }, footerIconPropsRef.value, { theme: mergedThemeRef.value.peers.Icon, themeOverrides: mergedThemeRef.value.peerOverrides.Icon }), {
314
- default: () => (0, vue_1.h)(icons_1.AttachIcon, null)
315
- }))
316
- }))
305
+ default: ({ handleClick }) => {
306
+ var _a;
307
+ return ((0, vue_1.h)(button_1.UButton, Object.assign({ secondary: true, size: "large", class: `${mergedClsPrefixRef.value}-chat-main__attach-btn` }, footerButtonPropsRef.value, { disabled: (_a = footerInputPropsRef.value) === null || _a === void 0 ? void 0 : _a.disabled, theme: mergedThemeRef.value.peers.Button, themeOverrides: mergedThemeRef.value.peerOverrides.Button, onClick: handleClick }), {
308
+ default: () => ((0, vue_1.h)(icon_1.UIcon, Object.assign({ size: 24 }, footerIconPropsRef.value, { theme: mergedThemeRef.value.peers.Icon, themeOverrides: mergedThemeRef.value.peerOverrides.Icon }), {
309
+ default: () => (0, vue_1.h)(icons_1.AttachIcon, null)
310
+ }))
311
+ }));
312
+ }
317
313
  }),
318
314
  (0, vue_1.h)(input_1.UInput, Object.assign({ ref: "inputRef", value: inputValue.value, placeholder: inputPlaceholderRef.value, class: `${mergedClsPrefixRef.value}-chat-main__input` }, footerInputPropsRef.value, { theme: mergedThemeRef.value.peers.Input, themeOverrides: mergedThemeRef.value.peerOverrides.Input, onUpdateValue: (value) => {
319
315
  inputValue.value = value;
@@ -347,7 +343,7 @@ exports.default = (0, vue_1.defineComponent)({
347
343
  const { mergedClsPrefixRef } = (0, vue_1.inject)(interface_1.chatInjectionKey);
348
344
  return ((0, vue_1.h)("div", { class: `${mergedClsPrefixRef.value}-chat-main` },
349
345
  this.renderHeader(),
350
- (0, vue_1.h)(scrollbar_1.UScrollbar, { ref: "messagesBodyRef", class: `${mergedClsPrefixRef.value}-chat-main__body`, onScroll: this.handleMessagesScroll }, {
346
+ (0, vue_1.h)(safe_top_scrollbar_1.USafeTopScrollbar, { ref: "messagesBodyRef", class: `${mergedClsPrefixRef.value}-chat-main__body`, onScroll: this.handleMessagesScroll }, {
351
347
  default: () => this.renderMessages()
352
348
  }),
353
349
  this.renderFooter()));
@@ -67,7 +67,7 @@ export interface ChatMessageData {
67
67
  timestamp?: string | number | Date | (() => VNodeChild);
68
68
  status?: MessageStatus;
69
69
  date?: string;
70
- attachment?: ChatAttachment | ChatAttachment[];
70
+ attachment?: ChatAttachment[];
71
71
  uploadProps?: Partial<UploadProps>;
72
72
  senderAvatar?: string | (() => VNodeChild);
73
73
  senderName?: string | (() => VNodeChild);
@@ -80,7 +80,7 @@ export interface ChatMessageProps {
80
80
  content?: string;
81
81
  timestamp?: string | number | Date | (() => VNodeChild);
82
82
  status?: MessageStatus;
83
- attachment?: ChatAttachment | ChatAttachment[];
83
+ attachment?: ChatAttachment[];
84
84
  uploadProps?: Partial<UploadProps>;
85
85
  senderAvatar?: string | (() => VNodeChild);
86
86
  senderName?: string | (() => VNodeChild);
@@ -165,6 +165,7 @@ export interface ChatProps {
165
165
  onMessageSend?: OnMessageSend;
166
166
  onMessageRetry?: (message: ChatMessageData) => void;
167
167
  onAttachmentUpload?: OnAttachmentUpload;
168
+ onAttachmentDownload?: OnAttachmentDownload;
168
169
  onFilterChange?: OnFilterChange;
169
170
  onFooterInputChange?: (value: string, chatId: ChatId) => void;
170
171
  onNetworkError?: OnNetworkError;
@@ -225,6 +226,7 @@ export interface ChatFooterProps {
225
226
  export type OnChatSelect = (key: ChatId, item: ChatListItemData) => void;
226
227
  export type OnMessageSend = (content: string, attachments?: ChatAttachment[]) => void;
227
228
  export type OnAttachmentUpload = (file: File) => Promise<ChatAttachment>;
229
+ export type OnAttachmentDownload = (attachment: ChatAttachment) => Promise<void>;
228
230
  export type OnFilterChange = (filter: {
229
231
  type: string;
230
232
  value: any;
@@ -311,6 +313,8 @@ export declare const chatInjectionKey: InjectionKey<{
311
313
  message: string;
312
314
  content: string;
313
315
  }) => void;
316
+ onAttachmentUpload?: Ref<OnAttachmentUpload | undefined>;
317
+ onAttachmentDownload?: Ref<OnAttachmentDownload | undefined>;
314
318
  onChatClose?: Ref<(() => void) | undefined>;
315
319
  onChatShare?: Ref<(() => void) | undefined>;
316
320
  onUserProfile?: Ref<(() => void) | undefined>;
@@ -69,6 +69,7 @@ export * from './radio';
69
69
  export * from './rate';
70
70
  export * from './result';
71
71
  export * from './scrollbar';
72
+ export * from './safe-top-scrollbar';
72
73
  export * from './select';
73
74
  export * from './skeleton';
74
75
  export * from './slider';
package/lib/components.js CHANGED
@@ -85,6 +85,7 @@ __exportStar(require("./radio"), exports);
85
85
  __exportStar(require("./rate"), exports);
86
86
  __exportStar(require("./result"), exports);
87
87
  __exportStar(require("./scrollbar"), exports);
88
+ __exportStar(require("./safe-top-scrollbar"), exports);
88
89
  __exportStar(require("./select"), exports);
89
90
  __exportStar(require("./skeleton"), exports);
90
91
  __exportStar(require("./slider"), exports);
@@ -104,6 +104,7 @@ import { ActionCardTheme } from '../../action-card';
104
104
  import { ChatTheme } from '../../chat/styles';
105
105
  import { ModalFullscreenTheme } from '../../modal-fullscreen/styles';
106
106
  import { CropTheme } from '../../crop/styles';
107
+ import { SafeTopScrollbarTheme } from '../../_internal/safe-top-scrollbar/styles';
107
108
  export interface GlobalThemeWithoutCommon {
108
109
  Alert?: AlertTheme;
109
110
  Anchor?: AnchorTheme;
@@ -165,6 +166,7 @@ export interface GlobalThemeWithoutCommon {
165
166
  Rate?: RateTheme;
166
167
  Result?: ResultTheme;
167
168
  Scrollbar?: ScrollbarTheme;
169
+ SafeTopScrollbar?: SafeTopScrollbarTheme;
168
170
  Select?: SelectTheme;
169
171
  Skeleton?: SkeletonTheme;
170
172
  Slider?: SliderTheme;
@@ -65,6 +65,12 @@ export declare const drawerProps: {
65
65
  readonly minHeight: NumberConstructor;
66
66
  readonly resizable: BooleanConstructor;
67
67
  readonly fullscreen: BooleanConstructor;
68
+ readonly defaultWidth: {
69
+ readonly type: PropType<string | number>;
70
+ };
71
+ readonly defaultHeight: {
72
+ readonly type: PropType<string | number>;
73
+ };
68
74
  readonly onUpdateWidth: PropType<MaybeArray<(value: number) => void>>;
69
75
  readonly onUpdateHeight: PropType<MaybeArray<(value: number) => void>>;
70
76
  readonly 'onUpdate:width': PropType<MaybeArray<(value: number) => void>>;
@@ -282,6 +288,12 @@ declare const _default: import("vue").DefineComponent<{
282
288
  readonly minHeight: NumberConstructor;
283
289
  readonly resizable: BooleanConstructor;
284
290
  readonly fullscreen: BooleanConstructor;
291
+ readonly defaultWidth: {
292
+ readonly type: PropType<string | number>;
293
+ };
294
+ readonly defaultHeight: {
295
+ readonly type: PropType<string | number>;
296
+ };
285
297
  readonly onUpdateWidth: PropType<MaybeArray<(value: number) => void>>;
286
298
  readonly onUpdateHeight: PropType<MaybeArray<(value: number) => void>>;
287
299
  readonly 'onUpdate:width': PropType<MaybeArray<(value: number) => void>>;
@@ -597,6 +609,12 @@ declare const _default: import("vue").DefineComponent<{
597
609
  readonly minHeight: NumberConstructor;
598
610
  readonly resizable: BooleanConstructor;
599
611
  readonly fullscreen: BooleanConstructor;
612
+ readonly defaultWidth: {
613
+ readonly type: PropType<string | number>;
614
+ };
615
+ readonly defaultHeight: {
616
+ readonly type: PropType<string | number>;
617
+ };
600
618
  readonly onUpdateWidth: PropType<MaybeArray<(value: number) => void>>;
601
619
  readonly onUpdateHeight: PropType<MaybeArray<(value: number) => void>>;
602
620
  readonly 'onUpdate:width': PropType<MaybeArray<(value: number) => void>>;