@uzum-tech/ui 1.8.2 → 1.9.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.
- package/dist/index.js +1244 -379
- package/dist/index.prod.js +3 -3
- package/es/_internal/scrollbar/src/Scrollbar.d.ts +119 -17
- package/es/_internal/scrollbar/src/Scrollbar.js +120 -67
- package/es/_internal/scrollbar/src/styles/index.cssr.js +32 -15
- package/es/_internal/scrollbar/styles/common.d.ts +7 -0
- package/es/_internal/scrollbar/styles/common.js +7 -0
- package/es/_internal/scrollbar/styles/light.d.ts +8 -0
- package/es/_internal/scrollbar/styles/light.js +3 -5
- package/es/_internal/select-menu/src/SelectMenu.d.ts +57 -1
- package/es/_internal/select-menu/styles/light.d.ts +8 -0
- package/es/_internal/selection/src/Selection.d.ts +3 -1
- package/es/_internal/selection/src/Selection.js +3 -1
- package/es/_utils/css/index.d.ts +1 -0
- package/es/_utils/css/index.js +1 -0
- package/es/_utils/css/rtl-inset.d.ts +1 -0
- package/es/_utils/css/rtl-inset.js +5 -0
- package/es/_utils/index.d.ts +1 -1
- package/es/_utils/index.js +1 -1
- package/es/auto-complete/src/AutoComplete.d.ts +88 -0
- package/es/auto-complete/styles/light.d.ts +8 -0
- package/es/back-top/src/BackTop.d.ts +1 -1
- package/es/cascader/src/Cascader.d.ts +168 -0
- package/es/cascader/src/CascaderMenu.d.ts +24 -0
- package/es/cascader/src/CascaderOption.d.ts +24 -0
- package/es/cascader/src/CascaderSelectMenu.d.ts +24 -0
- package/es/cascader/src/CascaderSubmenu.d.ts +25 -1
- package/es/cascader/styles/light.d.ts +16 -0
- package/es/chat/index.d.ts +1 -1
- package/es/chat/src/Chat.d.ts +321 -11
- package/es/chat/src/Chat.js +73 -22
- package/es/chat/src/ChatListItems.d.ts +104 -0
- package/es/chat/src/ChatMessages.d.ts +104 -0
- package/es/chat/src/ChatParts/ChatAttachment.js +14 -12
- package/es/chat/src/ChatParts/MainArea.d.ts +1 -0
- package/es/chat/src/ChatParts/MainArea.js +95 -57
- package/es/chat/src/ChatParts/Sidebar.d.ts +920 -0
- package/es/chat/src/ChatParts/Sidebar.js +63 -12
- package/es/chat/src/interface.d.ts +24 -3
- package/es/chat/src/styles/index.cssr.js +13 -2
- package/es/chat/styles/dark.d.ts +8 -0
- package/es/chat/styles/light.d.ts +8 -0
- package/es/components.d.ts +2 -0
- package/es/components.js +2 -0
- package/es/data-table/src/DataTable.d.ts +184 -0
- package/es/data-table/src/HeaderButton/FilterButton.d.ts +40 -0
- package/es/data-table/src/HeaderButton/FilterMenu.d.ts +40 -0
- package/es/data-table/src/TableParts/Body.d.ts +41 -1
- package/es/data-table/src/TableParts/Header.d.ts +40 -0
- package/es/data-table/src/interface.d.ts +72 -0
- package/es/data-table/styles/light.d.ts +24 -0
- package/es/date-picker/src/DatePicker.d.ts +1469 -36
- package/es/date-picker/src/DatePicker.js +54 -29
- package/es/date-picker/src/interface.d.ts +1 -0
- package/es/date-picker/src/panel/date.d.ts +166 -1
- package/es/date-picker/src/panel/daterange.d.ts +167 -2
- package/es/date-picker/src/panel/datetime.d.ts +166 -1
- package/es/date-picker/src/panel/datetimerange.d.ts +167 -2
- package/es/date-picker/src/panel/panelMonth.d.ts +332 -2
- package/es/date-picker/src/panel/panelMonthContent.d.ts +166 -1
- package/es/date-picker/src/panel/panelYear.d.ts +332 -2
- package/es/date-picker/src/panel/panelYearContent.d.ts +166 -1
- package/es/date-picker/src/panel/use-calendar.d.ts +165 -0
- package/es/date-picker/src/panel/use-dual-calendar.d.ts +165 -0
- package/es/date-picker/src/panel/use-panel-common.d.ts +165 -0
- package/es/date-picker/styles/dark.js +3 -1
- package/es/date-picker/styles/light.d.ts +139 -0
- package/es/date-picker/styles/light.js +3 -1
- package/es/descriptions/src/Descriptions.d.ts +30 -0
- package/es/descriptions/src/Descriptions.js +18 -10
- package/es/dialog/src/DialogProvider.d.ts +2 -2
- package/es/drawer/src/Drawer.d.ts +81 -1
- package/es/drawer/src/DrawerBodyWrapper.d.ts +9 -1
- package/es/drawer/src/DrawerContent.d.ts +8 -0
- package/es/drawer/styles/light.d.ts +8 -0
- package/es/dropdown/src/Dropdown.d.ts +1 -1
- package/es/infinite-scroll/index.d.ts +2 -0
- package/es/infinite-scroll/index.js +1 -0
- package/es/infinite-scroll/src/InfiniteScroll.d.ts +45 -0
- package/es/infinite-scroll/src/InfiniteScroll.js +78 -0
- package/es/layout/src/Layout.d.ts +112 -0
- package/es/layout/src/LayoutContent.d.ts +56 -0
- package/es/layout/src/LayoutFooter.d.ts +72 -0
- package/es/layout/src/LayoutHeader.d.ts +48 -0
- package/es/layout/src/LayoutSider.d.ts +56 -0
- package/es/layout/styles/light.d.ts +8 -0
- package/es/legacy-transfer/src/Transfer.d.ts +80 -0
- package/es/legacy-transfer/src/TransferFilter.d.ts +8 -0
- package/es/legacy-transfer/src/TransferList.d.ts +9 -1
- package/es/legacy-transfer/src/TransferListItem.d.ts +8 -0
- package/es/legacy-transfer/styles/light.d.ts +8 -0
- package/es/locales/common/arDZ.js +2 -0
- package/es/locales/common/deDE.js +2 -0
- package/es/locales/common/enGB.js +2 -0
- package/es/locales/common/enUS.d.ts +2 -0
- package/es/locales/common/enUS.js +2 -0
- package/es/locales/common/eo.js +2 -0
- package/es/locales/common/esAR.js +2 -0
- package/es/locales/common/faIR.js +2 -0
- package/es/locales/common/frFR.js +2 -0
- package/es/locales/common/idID.js +2 -0
- package/es/locales/common/itIT.js +2 -0
- package/es/locales/common/jaJP.js +2 -0
- package/es/locales/common/koKR.js +2 -0
- package/es/locales/common/nbNO.js +2 -0
- package/es/locales/common/nlNL.js +2 -0
- package/es/locales/common/plPL.js +2 -0
- package/es/locales/common/ptBR.js +2 -0
- package/es/locales/common/ruRU.js +2 -0
- package/es/locales/common/skSK.js +2 -0
- package/es/locales/common/svSE.js +2 -0
- package/es/locales/common/thTH.js +2 -0
- package/es/locales/common/trTR.js +2 -0
- package/es/locales/common/ukUA.js +2 -0
- package/es/locales/common/viVN.js +2 -0
- package/es/locales/common/zhCN.js +2 -0
- package/es/locales/common/zhTW.js +2 -0
- package/es/log/src/Log.d.ts +80 -0
- package/es/log/styles/light.d.ts +8 -0
- package/es/mention/src/Mention.d.ts +88 -0
- package/es/mention/styles/light.d.ts +8 -0
- package/es/menu/src/Menu.d.ts +1 -1
- package/es/modal/src/BodyWrapper.d.ts +9 -1
- package/es/modal/src/Modal.d.ts +73 -1
- package/es/modal/styles/light.d.ts +8 -0
- package/es/notification/src/NotificationContainer.d.ts +8 -0
- package/es/notification/src/NotificationProvider.d.ts +72 -0
- package/es/notification/styles/light.d.ts +8 -0
- package/es/pagination/src/Pagination.d.ts +176 -0
- package/es/pagination/styles/light.d.ts +16 -0
- package/es/popselect/src/Popselect.d.ts +88 -0
- package/es/popselect/src/PopselectPanel.d.ts +16 -0
- package/es/popselect/styles/light.d.ts +8 -0
- package/es/scrollbar/src/Scrollbar.d.ts +72 -0
- package/es/select/src/Select.d.ts +88 -0
- package/es/select/styles/light.d.ts +8 -0
- package/es/time-picker/src/Panel.d.ts +8 -0
- package/es/time-picker/src/TimePicker.d.ts +80 -0
- package/es/time-picker/styles/light.d.ts +8 -0
- package/es/transfer/src/Transfer.d.ts +80 -0
- package/es/transfer/src/TransferFilter.d.ts +8 -0
- package/es/transfer/src/TransferList.d.ts +9 -1
- package/es/transfer/src/TransferListItem.d.ts +8 -0
- package/es/transfer/styles/light.d.ts +8 -0
- package/es/tree/src/Tree.d.ts +82 -2
- package/es/tree/src/TreeNodeCheckbox.d.ts +8 -0
- package/es/tree/styles/light.d.ts +8 -0
- package/es/tree-select/src/TreeSelect.d.ts +89 -1
- package/es/tree-select/styles/light.d.ts +8 -0
- package/es/version.d.ts +1 -1
- package/es/version.js +1 -1
- package/es/virtual-list/index.d.ts +2 -0
- package/es/virtual-list/index.js +1 -0
- package/es/virtual-list/src/VirtualList.d.ts +146 -0
- package/es/virtual-list/src/VirtualList.js +103 -0
- package/lib/_internal/scrollbar/src/Scrollbar.d.ts +119 -17
- package/lib/_internal/scrollbar/src/Scrollbar.js +117 -64
- package/lib/_internal/scrollbar/src/styles/index.cssr.js +32 -15
- package/lib/_internal/scrollbar/styles/common.d.ts +7 -0
- package/lib/_internal/scrollbar/styles/common.js +10 -0
- package/lib/_internal/scrollbar/styles/light.d.ts +8 -0
- package/lib/_internal/scrollbar/styles/light.js +3 -5
- package/lib/_internal/select-menu/src/SelectMenu.d.ts +57 -1
- package/lib/_internal/select-menu/styles/light.d.ts +8 -0
- package/lib/_internal/selection/src/Selection.d.ts +3 -1
- package/lib/_internal/selection/src/Selection.js +3 -1
- package/lib/_utils/css/index.d.ts +1 -0
- package/lib/_utils/css/index.js +3 -1
- package/lib/_utils/css/rtl-inset.d.ts +1 -0
- package/lib/_utils/css/rtl-inset.js +8 -0
- package/lib/_utils/index.d.ts +1 -1
- package/lib/_utils/index.js +2 -1
- package/lib/auto-complete/src/AutoComplete.d.ts +88 -0
- package/lib/auto-complete/styles/light.d.ts +8 -0
- package/lib/back-top/src/BackTop.d.ts +1 -1
- package/lib/cascader/src/Cascader.d.ts +168 -0
- package/lib/cascader/src/CascaderMenu.d.ts +24 -0
- package/lib/cascader/src/CascaderOption.d.ts +24 -0
- package/lib/cascader/src/CascaderSelectMenu.d.ts +24 -0
- package/lib/cascader/src/CascaderSubmenu.d.ts +25 -1
- package/lib/cascader/styles/light.d.ts +16 -0
- package/lib/chat/index.d.ts +1 -1
- package/lib/chat/src/Chat.d.ts +321 -11
- package/lib/chat/src/Chat.js +73 -22
- package/lib/chat/src/ChatListItems.d.ts +104 -0
- package/lib/chat/src/ChatMessages.d.ts +104 -0
- package/lib/chat/src/ChatParts/ChatAttachment.js +14 -12
- package/lib/chat/src/ChatParts/MainArea.d.ts +1 -0
- package/lib/chat/src/ChatParts/MainArea.js +94 -56
- package/lib/chat/src/ChatParts/Sidebar.d.ts +920 -0
- package/lib/chat/src/ChatParts/Sidebar.js +62 -11
- package/lib/chat/src/interface.d.ts +24 -3
- package/lib/chat/src/styles/index.cssr.js +13 -2
- package/lib/chat/styles/dark.d.ts +8 -0
- package/lib/chat/styles/light.d.ts +8 -0
- package/lib/components.d.ts +2 -0
- package/lib/components.js +2 -0
- package/lib/data-table/src/DataTable.d.ts +184 -0
- package/lib/data-table/src/HeaderButton/FilterButton.d.ts +40 -0
- package/lib/data-table/src/HeaderButton/FilterMenu.d.ts +40 -0
- package/lib/data-table/src/TableParts/Body.d.ts +41 -1
- package/lib/data-table/src/TableParts/Header.d.ts +40 -0
- package/lib/data-table/src/interface.d.ts +72 -0
- package/lib/data-table/styles/light.d.ts +24 -0
- package/lib/date-picker/src/DatePicker.d.ts +1469 -36
- package/lib/date-picker/src/DatePicker.js +53 -28
- package/lib/date-picker/src/interface.d.ts +1 -0
- package/lib/date-picker/src/panel/date.d.ts +166 -1
- package/lib/date-picker/src/panel/daterange.d.ts +167 -2
- package/lib/date-picker/src/panel/datetime.d.ts +166 -1
- package/lib/date-picker/src/panel/datetimerange.d.ts +167 -2
- package/lib/date-picker/src/panel/panelMonth.d.ts +332 -2
- package/lib/date-picker/src/panel/panelMonthContent.d.ts +166 -1
- package/lib/date-picker/src/panel/panelYear.d.ts +332 -2
- package/lib/date-picker/src/panel/panelYearContent.d.ts +166 -1
- package/lib/date-picker/src/panel/use-calendar.d.ts +165 -0
- package/lib/date-picker/src/panel/use-dual-calendar.d.ts +165 -0
- package/lib/date-picker/src/panel/use-panel-common.d.ts +165 -0
- package/lib/date-picker/styles/dark.js +3 -1
- package/lib/date-picker/styles/light.d.ts +139 -0
- package/lib/date-picker/styles/light.js +3 -1
- package/lib/descriptions/src/Descriptions.d.ts +30 -0
- package/lib/descriptions/src/Descriptions.js +18 -10
- package/lib/dialog/src/DialogProvider.d.ts +2 -2
- package/lib/drawer/src/Drawer.d.ts +81 -1
- package/lib/drawer/src/DrawerBodyWrapper.d.ts +9 -1
- package/lib/drawer/src/DrawerContent.d.ts +8 -0
- package/lib/drawer/styles/light.d.ts +8 -0
- package/lib/dropdown/src/Dropdown.d.ts +1 -1
- package/lib/infinite-scroll/index.d.ts +2 -0
- package/lib/infinite-scroll/index.js +9 -0
- package/lib/infinite-scroll/src/InfiniteScroll.d.ts +45 -0
- package/lib/infinite-scroll/src/InfiniteScroll.js +81 -0
- package/lib/layout/src/Layout.d.ts +112 -0
- package/lib/layout/src/LayoutContent.d.ts +56 -0
- package/lib/layout/src/LayoutFooter.d.ts +72 -0
- package/lib/layout/src/LayoutHeader.d.ts +48 -0
- package/lib/layout/src/LayoutSider.d.ts +56 -0
- package/lib/layout/styles/light.d.ts +8 -0
- package/lib/legacy-transfer/src/Transfer.d.ts +80 -0
- package/lib/legacy-transfer/src/TransferFilter.d.ts +8 -0
- package/lib/legacy-transfer/src/TransferList.d.ts +9 -1
- package/lib/legacy-transfer/src/TransferListItem.d.ts +8 -0
- package/lib/legacy-transfer/styles/light.d.ts +8 -0
- package/lib/locales/common/arDZ.js +2 -0
- package/lib/locales/common/deDE.js +2 -0
- package/lib/locales/common/enGB.js +2 -0
- package/lib/locales/common/enUS.d.ts +2 -0
- package/lib/locales/common/enUS.js +2 -0
- package/lib/locales/common/eo.js +2 -0
- package/lib/locales/common/esAR.js +2 -0
- package/lib/locales/common/faIR.js +2 -0
- package/lib/locales/common/frFR.js +2 -0
- package/lib/locales/common/idID.js +2 -0
- package/lib/locales/common/itIT.js +2 -0
- package/lib/locales/common/jaJP.js +2 -0
- package/lib/locales/common/koKR.js +2 -0
- package/lib/locales/common/nbNO.js +2 -0
- package/lib/locales/common/nlNL.js +2 -0
- package/lib/locales/common/plPL.js +2 -0
- package/lib/locales/common/ptBR.js +2 -0
- package/lib/locales/common/ruRU.js +2 -0
- package/lib/locales/common/skSK.js +2 -0
- package/lib/locales/common/svSE.js +2 -0
- package/lib/locales/common/thTH.js +2 -0
- package/lib/locales/common/trTR.js +2 -0
- package/lib/locales/common/ukUA.js +2 -0
- package/lib/locales/common/viVN.js +2 -0
- package/lib/locales/common/zhCN.js +2 -0
- package/lib/locales/common/zhTW.js +2 -0
- package/lib/log/src/Log.d.ts +80 -0
- package/lib/log/styles/light.d.ts +8 -0
- package/lib/mention/src/Mention.d.ts +88 -0
- package/lib/mention/styles/light.d.ts +8 -0
- package/lib/menu/src/Menu.d.ts +1 -1
- package/lib/modal/src/BodyWrapper.d.ts +9 -1
- package/lib/modal/src/Modal.d.ts +73 -1
- package/lib/modal/styles/light.d.ts +8 -0
- package/lib/notification/src/NotificationContainer.d.ts +8 -0
- package/lib/notification/src/NotificationProvider.d.ts +72 -0
- package/lib/notification/styles/light.d.ts +8 -0
- package/lib/pagination/src/Pagination.d.ts +176 -0
- package/lib/pagination/styles/light.d.ts +16 -0
- package/lib/popselect/src/Popselect.d.ts +88 -0
- package/lib/popselect/src/PopselectPanel.d.ts +16 -0
- package/lib/popselect/styles/light.d.ts +8 -0
- package/lib/scrollbar/src/Scrollbar.d.ts +72 -0
- package/lib/select/src/Select.d.ts +88 -0
- package/lib/select/styles/light.d.ts +8 -0
- package/lib/time-picker/src/Panel.d.ts +8 -0
- package/lib/time-picker/src/TimePicker.d.ts +80 -0
- package/lib/time-picker/styles/light.d.ts +8 -0
- package/lib/transfer/src/Transfer.d.ts +80 -0
- package/lib/transfer/src/TransferFilter.d.ts +8 -0
- package/lib/transfer/src/TransferList.d.ts +9 -1
- package/lib/transfer/src/TransferListItem.d.ts +8 -0
- package/lib/transfer/styles/light.d.ts +8 -0
- package/lib/tree/src/Tree.d.ts +82 -2
- package/lib/tree/src/TreeNodeCheckbox.d.ts +8 -0
- package/lib/tree/styles/light.d.ts +8 -0
- package/lib/tree-select/src/TreeSelect.d.ts +89 -1
- package/lib/tree-select/styles/light.d.ts +8 -0
- package/lib/version.d.ts +1 -1
- package/lib/version.js +1 -1
- package/lib/virtual-list/index.d.ts +2 -0
- package/lib/virtual-list/index.js +9 -0
- package/lib/virtual-list/src/VirtualList.d.ts +146 -0
- package/lib/virtual-list/src/VirtualList.js +106 -0
- package/package.json +4 -4
- package/volar.d.ts +1 -0
- package/web-types.json +124 -4
|
@@ -23,21 +23,21 @@ exports.default = (0, vue_1.defineComponent)({
|
|
|
23
23
|
}
|
|
24
24
|
},
|
|
25
25
|
setup(props, { slots }) {
|
|
26
|
-
const getThumbnailUrl = (
|
|
27
|
-
const url = [
|
|
26
|
+
const getThumbnailUrl = (attachment) => {
|
|
27
|
+
const url = [attachment.preview, attachment.thumbnail].find((value) => typeof value === 'string');
|
|
28
28
|
return url !== null && url !== void 0 ? url : null;
|
|
29
29
|
};
|
|
30
30
|
const renderAttachment = () => {
|
|
31
|
-
const fileList = props.attachments.map((
|
|
31
|
+
const fileList = props.attachments.map((attachment, index) => {
|
|
32
32
|
var _a, _b, _c;
|
|
33
33
|
return ({
|
|
34
34
|
id: `${String(props.message.id)}-attachment-${index}`,
|
|
35
|
-
name:
|
|
36
|
-
status:
|
|
37
|
-
percentage: (_a =
|
|
38
|
-
url: (_b =
|
|
39
|
-
thumbnailUrl: getThumbnailUrl(
|
|
40
|
-
type: (_c =
|
|
35
|
+
name: attachment.name,
|
|
36
|
+
status: attachment.status || 'finished',
|
|
37
|
+
percentage: (_a = attachment.percentage) !== null && _a !== void 0 ? _a : null,
|
|
38
|
+
url: (_b = attachment.url) !== null && _b !== void 0 ? _b : null,
|
|
39
|
+
thumbnailUrl: getThumbnailUrl(attachment),
|
|
40
|
+
type: (_c = attachment.type) !== null && _c !== void 0 ? _c : null,
|
|
41
41
|
file: null,
|
|
42
42
|
batchId: null
|
|
43
43
|
});
|
|
@@ -49,7 +49,9 @@ exports.default = (0, vue_1.defineComponent)({
|
|
|
49
49
|
gap: '2px',
|
|
50
50
|
marginTop: '0'
|
|
51
51
|
}
|
|
52
|
-
: undefined, showRemoveButton: false, showDownloadButton: props.attachments.some((
|
|
52
|
+
: undefined, showRemoveButton: false, showDownloadButton: props.attachments.some((attachment) => attachment.status === 'finished' &&
|
|
53
|
+
attachment.url &&
|
|
54
|
+
attachment.url !== '#'), showRetryButton: props.attachments.some((attachment) => attachment.status === 'error') }, props.uploadProps), {
|
|
53
55
|
default: () => ((0, vue_1.h)(upload_1.UUploadFileList, null, {
|
|
54
56
|
'upload-file-title': slots['upload-file-title']
|
|
55
57
|
? ({ file }) => { var _a; return (_a = slots['upload-file-title']) === null || _a === void 0 ? void 0 : _a.call(slots, file); }
|
|
@@ -58,8 +60,8 @@ exports.default = (0, vue_1.defineComponent)({
|
|
|
58
60
|
? ({ file }) => { var _a; return (_a = slots['upload-file-subtitle']) === null || _a === void 0 ? void 0 : _a.call(slots, file); }
|
|
59
61
|
: ({ file }) => {
|
|
60
62
|
var _a;
|
|
61
|
-
const
|
|
62
|
-
return ((0, vue_1.h)("span", { style: { fontSize: '12px', color: '#999' } }, (
|
|
63
|
+
const attachment = props.attachments.find((attachment) => attachment.name === file.name);
|
|
64
|
+
return ((0, vue_1.h)("span", { style: { fontSize: '12px', color: '#999' } }, (attachment === null || attachment === void 0 ? void 0 : attachment.size) || ((_a = file.file) === null || _a === void 0 ? void 0 : _a.size)));
|
|
63
65
|
}
|
|
64
66
|
}))
|
|
65
67
|
}));
|
|
@@ -8,6 +8,7 @@ declare const _default: import("vue").DefineComponent<{}, {
|
|
|
8
8
|
inputRef: import("vue").Ref<HTMLInputElement | undefined>;
|
|
9
9
|
inputValue: import("vue").Ref<string>;
|
|
10
10
|
handleSendMessage: () => Promise<void>;
|
|
11
|
+
handleMessagesScroll: (e: Event) => void;
|
|
11
12
|
scrollToBottom: () => void;
|
|
12
13
|
}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{}>>, {}, {}>;
|
|
13
14
|
export default _default;
|
|
@@ -18,24 +18,27 @@ const input_1 = require("../../../input");
|
|
|
18
18
|
const button_1 = require("../../../button");
|
|
19
19
|
const icon_1 = require("../../../icon");
|
|
20
20
|
const scrollbar_1 = require("../../../scrollbar");
|
|
21
|
+
const tooltip_1 = require("../../../tooltip");
|
|
21
22
|
const upload_1 = require("../../../upload");
|
|
22
23
|
const flex_1 = require("../../../flex");
|
|
23
24
|
const _utils_1 = require("../../../_utils");
|
|
24
25
|
const typography_1 = require("../../../typography");
|
|
25
26
|
const ChatMessages_1 = __importDefault(require("../ChatMessages"));
|
|
26
27
|
const icons_1 = require("../../../_internal/icons");
|
|
27
|
-
const SCROLL_DELAY = 50;
|
|
28
28
|
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, messageUploadPropsRef, footerInputPropsRef, footerButtonPropsRef, footerUploadPropsRef, footerIconPropsRef, inputPlaceholderRef, retryTextRef, typingTextRef, closeButtonTextRef, unreadNotificationTextRef, notificationsShownSetRef, unreadCountsBeforeReadRef, markNotificationShown, handleMessageSend, handleMessageRetry, onChatClose, onChatShare, onUserProfile
|
|
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
|
|
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 lastScrollTop = (0, vue_1.ref)(0);
|
|
40
|
+
const scrollTopFired = (0, vue_1.ref)(false);
|
|
41
|
+
const scrollBottomFired = (0, vue_1.ref)(false);
|
|
39
42
|
const unreadMessagesCount = (0, vue_1.computed)(() => {
|
|
40
43
|
if (!messagesRef.value)
|
|
41
44
|
return 0;
|
|
@@ -46,12 +49,17 @@ exports.default = (0, vue_1.defineComponent)({
|
|
|
46
49
|
const unreadCountOnOpen = (0, vue_1.ref)(0);
|
|
47
50
|
const chatInputs = (0, vue_1.ref)({});
|
|
48
51
|
const lastMessageId = (0, vue_1.ref)(null);
|
|
52
|
+
const shouldScrollOnLoad = (0, vue_1.ref)(false);
|
|
49
53
|
(0, vue_1.watch)(selectedChatRef, (newChat, oldChat) => {
|
|
50
54
|
if (newChat && newChat.id !== (oldChat === null || oldChat === void 0 ? void 0 : oldChat.id)) {
|
|
51
55
|
inputValue.value = chatInputs.value[newChat.id] || '';
|
|
52
56
|
const unreadBeforeRead = unreadCountsBeforeReadRef.value[newChat.id] || 0;
|
|
53
57
|
unreadCountOnOpen.value = unreadBeforeRead;
|
|
54
58
|
lastMessageId.value = null;
|
|
59
|
+
lastScrollTop.value = 0;
|
|
60
|
+
scrollTopFired.value = false;
|
|
61
|
+
scrollBottomFired.value = false;
|
|
62
|
+
shouldScrollOnLoad.value = true;
|
|
55
63
|
if (unreadBeforeRead > 0 &&
|
|
56
64
|
!notificationsShownSetRef.value.has(newChat.id)) {
|
|
57
65
|
hasUnreadMessages.value = true;
|
|
@@ -62,12 +70,6 @@ exports.default = (0, vue_1.defineComponent)({
|
|
|
62
70
|
hasUnreadMessages.value = false;
|
|
63
71
|
showNotificationManually.value = false;
|
|
64
72
|
}
|
|
65
|
-
void (0, vue_1.nextTick)(() => {
|
|
66
|
-
scrollToBottom();
|
|
67
|
-
});
|
|
68
|
-
setTimeout(() => {
|
|
69
|
-
scrollToBottom();
|
|
70
|
-
}, SCROLL_DELAY);
|
|
71
73
|
}
|
|
72
74
|
}, { immediate: true });
|
|
73
75
|
(0, vue_1.watch)(messagesRef, (newMessages) => {
|
|
@@ -77,19 +79,18 @@ exports.default = (0, vue_1.defineComponent)({
|
|
|
77
79
|
}
|
|
78
80
|
const currentLastMessage = newMessages[newMessages.length - 1];
|
|
79
81
|
const currentLastId = currentLastMessage === null || currentLastMessage === void 0 ? void 0 : currentLastMessage.id;
|
|
80
|
-
|
|
81
|
-
|
|
82
|
+
const hasLastMessageChanged = currentLastId !== lastMessageId.value;
|
|
83
|
+
if (hasLastMessageChanged &&
|
|
84
|
+
currentLastMessage &&
|
|
85
|
+
!currentLastMessage.isOwn &&
|
|
86
|
+
currentLastMessage.status === interface_1.MessageStatus.UNREAD) {
|
|
87
|
+
unreadCountOnOpen.value = unreadMessagesCount.value;
|
|
88
|
+
}
|
|
89
|
+
if (shouldScrollOnLoad.value && newMessages.length > 0) {
|
|
90
|
+
shouldScrollOnLoad.value = false;
|
|
82
91
|
void (0, vue_1.nextTick)(() => {
|
|
83
92
|
scrollToBottom();
|
|
84
93
|
});
|
|
85
|
-
setTimeout(() => {
|
|
86
|
-
scrollToBottom();
|
|
87
|
-
}, SCROLL_DELAY);
|
|
88
|
-
if (currentLastMessage &&
|
|
89
|
-
!currentLastMessage.isOwn &&
|
|
90
|
-
currentLastMessage.status === interface_1.MessageStatus.UNREAD) {
|
|
91
|
-
unreadCountOnOpen.value = unreadMessagesCount.value;
|
|
92
|
-
}
|
|
93
94
|
}
|
|
94
95
|
lastMessageId.value = currentLastId !== null && currentLastId !== void 0 ? currentLastId : null;
|
|
95
96
|
}, { deep: true, flush: 'post' });
|
|
@@ -102,17 +103,42 @@ exports.default = (0, vue_1.defineComponent)({
|
|
|
102
103
|
notificationsShownSetRef.value = newSet;
|
|
103
104
|
}
|
|
104
105
|
});
|
|
106
|
+
(0, vue_1.watch)(inputValue, (newValue) => {
|
|
107
|
+
if (selectedChatRef.value) {
|
|
108
|
+
handleFooterInputChange(newValue, selectedChatRef.value.id);
|
|
109
|
+
}
|
|
110
|
+
});
|
|
105
111
|
const showUnreadNotification = (0, vue_1.computed)(() => {
|
|
106
112
|
return hasUnreadMessages.value && showNotificationManually.value;
|
|
107
113
|
});
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
114
|
+
const handleMessagesScroll = (e) => {
|
|
115
|
+
var _a, _b;
|
|
116
|
+
const target = e.target;
|
|
117
|
+
if (!target)
|
|
118
|
+
return;
|
|
119
|
+
const { scrollTop, scrollHeight, clientHeight } = target;
|
|
120
|
+
const threshold = 5;
|
|
121
|
+
const scrollDirection = scrollTop > lastScrollTop.value ? 'down' : 'up';
|
|
122
|
+
const nearTop = scrollTop <= threshold;
|
|
123
|
+
const nearBottom = scrollHeight - (scrollTop + clientHeight) <= threshold;
|
|
124
|
+
if (scrollTop > threshold) {
|
|
125
|
+
scrollTopFired.value = false;
|
|
126
|
+
}
|
|
127
|
+
if (scrollHeight - (scrollTop + clientHeight) > threshold) {
|
|
128
|
+
scrollBottomFired.value = false;
|
|
129
|
+
}
|
|
130
|
+
if (nearTop && scrollDirection === 'up' && !scrollTopFired.value) {
|
|
131
|
+
scrollTopFired.value = true;
|
|
132
|
+
(_a = onMessagesScrollToTop === null || onMessagesScrollToTop === void 0 ? void 0 : onMessagesScrollToTop.value) === null || _a === void 0 ? void 0 : _a.call(onMessagesScrollToTop);
|
|
133
|
+
}
|
|
134
|
+
if (nearBottom &&
|
|
135
|
+
scrollDirection === 'down' &&
|
|
136
|
+
!scrollBottomFired.value) {
|
|
137
|
+
scrollBottomFired.value = true;
|
|
138
|
+
(_b = onMessagesScrollToBottom === null || onMessagesScrollToBottom === void 0 ? void 0 : onMessagesScrollToBottom.value) === null || _b === void 0 ? void 0 : _b.call(onMessagesScrollToBottom);
|
|
139
|
+
}
|
|
140
|
+
lastScrollTop.value = scrollTop;
|
|
141
|
+
};
|
|
116
142
|
const scrollToBottom = () => {
|
|
117
143
|
const el = messagesBodyRef.value;
|
|
118
144
|
if (!el)
|
|
@@ -134,27 +160,50 @@ exports.default = (0, vue_1.defineComponent)({
|
|
|
134
160
|
};
|
|
135
161
|
const renderHeader = () => {
|
|
136
162
|
return ((0, vue_1.h)("div", { class: `${mergedClsPrefixRef.value}-chat-main__header` },
|
|
137
|
-
(0, vue_1.h)(flex_1.UFlex, { justify: "space-between", align: "flex-start" }, {
|
|
163
|
+
(0, vue_1.h)(flex_1.UFlex, { justify: "space-between", align: "flex-start", wrap: false }, {
|
|
138
164
|
default: () => ((0, vue_1.h)(vue_1.Fragment, null,
|
|
139
165
|
(0, vue_1.h)(typography_1.UText, { variant: "heading-s-bold", class: `${mergedClsPrefixRef.value}-chat-main__header-title`, theme: mergedThemeRef.value.peers.Typography, themeOverrides: mergedThemeRef.value.peerOverrides.Typography }, {
|
|
140
|
-
default: () => { var _a; return ((_a = selectedChatRef.value) === null || _a === void 0 ? void 0 : _a.title)
|
|
166
|
+
default: () => { var _a, _b; return (_b = (_a = selectedChatRef.value) === null || _a === void 0 ? void 0 : _a.title) !== null && _b !== void 0 ? _b : ''; }
|
|
141
167
|
}),
|
|
142
168
|
(0, vue_1.h)(flex_1.UFlex, { align: "center", size: "small", class: `${mergedClsPrefixRef.value}-chat-main__header-actions` }, {
|
|
143
|
-
default: () => (0, _utils_1.resolveSlot)(slots.headerActions, () =>
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
}),
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
169
|
+
default: () => (0, _utils_1.resolveSlot)(slots.headerActions, () => {
|
|
170
|
+
const shareButtonProps = Object.assign(Object.assign({}, headerButtonPropsRef.value), headerShareButtonPropsRef.value);
|
|
171
|
+
const profileButtonProps = Object.assign(Object.assign({}, headerButtonPropsRef.value), headerProfileButtonPropsRef.value);
|
|
172
|
+
const closeButtonProps = Object.assign(Object.assign({}, headerButtonPropsRef.value), headerCloseButtonPropsRef.value);
|
|
173
|
+
const shareIconProps = Object.assign(Object.assign({}, headerIconPropsRef.value), headerShareIconPropsRef.value);
|
|
174
|
+
const profileIconProps = Object.assign(Object.assign({}, headerIconPropsRef.value), headerProfileIconPropsRef.value);
|
|
175
|
+
const buttons = [];
|
|
176
|
+
if (shareButtonProps.disabled !== true) {
|
|
177
|
+
buttons.push((0, vue_1.h)(tooltip_1.UTooltip, null, {
|
|
178
|
+
trigger: () => ((0, vue_1.h)(button_1.UButton, Object.assign({ secondary: true, circle: true, size: "large" }, shareButtonProps, { theme: mergedThemeRef.value.peers.Button, themeOverrides: mergedThemeRef.value.peerOverrides
|
|
179
|
+
.Button, onClick: () => { var _a; return (_a = onChatShare === null || onChatShare === void 0 ? void 0 : onChatShare.value) === null || _a === void 0 ? void 0 : _a.call(onChatShare); } }), {
|
|
180
|
+
default: () => ((0, vue_1.h)(icon_1.UIcon, Object.assign({ size: 20 }, shareIconProps, { theme: mergedThemeRef.value.peers.Icon, themeOverrides: mergedThemeRef.value.peerOverrides
|
|
181
|
+
.Icon }), {
|
|
182
|
+
default: () => ((0, vue_1.h)(icons_1.ArrowHookUpRight, null))
|
|
183
|
+
}))
|
|
184
|
+
})),
|
|
185
|
+
default: () => shareButtonTooltipRef.value
|
|
186
|
+
}));
|
|
187
|
+
}
|
|
188
|
+
if (profileButtonProps.disabled !== true) {
|
|
189
|
+
buttons.push((0, vue_1.h)(tooltip_1.UTooltip, null, {
|
|
190
|
+
trigger: () => ((0, vue_1.h)(button_1.UButton, Object.assign({ secondary: true, circle: true, size: "large" }, profileButtonProps, { theme: mergedThemeRef.value.peers.Button, themeOverrides: mergedThemeRef.value.peerOverrides
|
|
191
|
+
.Button, onClick: () => { var _a; return (_a = onUserProfile === null || onUserProfile === void 0 ? void 0 : onUserProfile.value) === null || _a === void 0 ? void 0 : _a.call(onUserProfile); } }), {
|
|
192
|
+
default: () => ((0, vue_1.h)(icon_1.UIcon, Object.assign({ size: 20 }, profileIconProps, { theme: mergedThemeRef.value.peers.Icon, themeOverrides: mergedThemeRef.value.peerOverrides
|
|
193
|
+
.Icon }), {
|
|
194
|
+
default: () => (0, vue_1.h)(icons_1.PersonNote, null)
|
|
195
|
+
}))
|
|
196
|
+
})),
|
|
197
|
+
default: () => profileButtonTooltipRef.value
|
|
198
|
+
}));
|
|
199
|
+
}
|
|
200
|
+
if (closeButtonProps.disabled !== true) {
|
|
201
|
+
buttons.push((0, vue_1.h)(button_1.UButton, Object.assign({ type: "primary", size: "large", round: true }, closeButtonProps, { theme: mergedThemeRef.value.peers.Button, themeOverrides: mergedThemeRef.value.peerOverrides.Button, onClick: () => { var _a; return (_a = onChatClose === null || onChatClose === void 0 ? void 0 : onChatClose.value) === null || _a === void 0 ? void 0 : _a.call(onChatClose); } }), {
|
|
202
|
+
default: () => closeButtonTextRef.value
|
|
203
|
+
}));
|
|
204
|
+
}
|
|
205
|
+
return buttons;
|
|
206
|
+
})
|
|
158
207
|
})))
|
|
159
208
|
})));
|
|
160
209
|
};
|
|
@@ -201,12 +250,6 @@ exports.default = (0, vue_1.defineComponent)({
|
|
|
201
250
|
chatInputs.value[selectedChatRef.value.id] = '';
|
|
202
251
|
hasUnreadMessages.value = false;
|
|
203
252
|
showNotificationManually.value = false;
|
|
204
|
-
void (0, vue_1.nextTick)(() => {
|
|
205
|
-
scrollToBottom();
|
|
206
|
-
});
|
|
207
|
-
setTimeout(() => {
|
|
208
|
-
scrollToBottom();
|
|
209
|
-
}, SCROLL_DELAY);
|
|
210
253
|
}
|
|
211
254
|
finally {
|
|
212
255
|
setTimeout(() => {
|
|
@@ -246,12 +289,6 @@ exports.default = (0, vue_1.defineComponent)({
|
|
|
246
289
|
handleMessageSend('', attachments);
|
|
247
290
|
pendingFiles.value = [];
|
|
248
291
|
attachmentFileList.value = [];
|
|
249
|
-
void (0, vue_1.nextTick)(() => {
|
|
250
|
-
scrollToBottom();
|
|
251
|
-
});
|
|
252
|
-
setTimeout(() => {
|
|
253
|
-
scrollToBottom();
|
|
254
|
-
}, SCROLL_DELAY);
|
|
255
292
|
}
|
|
256
293
|
}, SENDING_DELAY);
|
|
257
294
|
}
|
|
@@ -291,6 +328,7 @@ exports.default = (0, vue_1.defineComponent)({
|
|
|
291
328
|
inputRef,
|
|
292
329
|
inputValue,
|
|
293
330
|
handleSendMessage,
|
|
331
|
+
handleMessagesScroll,
|
|
294
332
|
scrollToBottom
|
|
295
333
|
};
|
|
296
334
|
},
|
|
@@ -299,7 +337,7 @@ exports.default = (0, vue_1.defineComponent)({
|
|
|
299
337
|
const { mergedClsPrefixRef } = (0, vue_1.inject)(interface_1.chatInjectionKey);
|
|
300
338
|
return ((0, vue_1.h)("div", { class: `${mergedClsPrefixRef.value}-chat-main` },
|
|
301
339
|
this.renderHeader(),
|
|
302
|
-
(0, vue_1.h)(scrollbar_1.UScrollbar, { ref: "messagesBodyRef", class: `${mergedClsPrefixRef.value}-chat-main__body
|
|
340
|
+
(0, vue_1.h)(scrollbar_1.UScrollbar, { ref: "messagesBodyRef", class: `${mergedClsPrefixRef.value}-chat-main__body`, onScroll: this.handleMessagesScroll }, {
|
|
303
341
|
default: () => this.renderMessages()
|
|
304
342
|
}),
|
|
305
343
|
this.renderFooter()));
|