@uzum-tech/ui 1.9.0 → 1.10.0
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 +5789 -1014
- package/dist/index.prod.js +12 -3
- package/es/_internal/scrollbar/src/Scrollbar.js +19 -38
- package/es/auto-complete/src/AutoComplete.d.ts +1 -1
- package/es/cascader/src/Cascader.d.ts +1 -1
- package/es/chat/index.d.ts +1 -1
- package/es/chat/src/Chat.d.ts +233 -11
- package/es/chat/src/Chat.js +73 -22
- 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/components.d.ts +2 -0
- package/es/components.js +2 -0
- package/es/config-provider/src/internal-interface.d.ts +4 -0
- package/es/crop/index.d.ts +3 -0
- package/es/crop/index.js +1 -0
- package/es/crop/src/Crop.d.ts +222 -0
- package/es/crop/src/Crop.js +157 -0
- package/es/crop/src/interface.d.ts +6 -0
- package/es/crop/src/interface.js +7 -0
- package/es/crop/src/styles/index.cssr.d.ts +2 -0
- package/es/crop/src/styles/index.cssr.js +333 -0
- package/es/crop/styles/_common.d.ts +4 -0
- package/es/crop/styles/_common.js +3 -0
- package/es/crop/styles/dark.d.ts +3 -0
- package/es/crop/styles/dark.js +9 -0
- package/es/crop/styles/index.d.ts +3 -0
- package/es/crop/styles/index.js +2 -0
- package/es/crop/styles/light.d.ts +14 -0
- package/es/crop/styles/light.js +14 -0
- package/es/date-picker/src/DatePicker.d.ts +1308 -43
- 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 +141 -0
- package/es/date-picker/src/panel/daterange.d.ts +141 -0
- package/es/date-picker/src/panel/datetime.d.ts +141 -0
- package/es/date-picker/src/panel/datetimerange.d.ts +141 -0
- package/es/date-picker/src/panel/panelMonth.d.ts +283 -1
- package/es/date-picker/src/panel/panelMonthContent.d.ts +141 -0
- package/es/date-picker/src/panel/panelYear.d.ts +283 -1
- package/es/date-picker/src/panel/panelYearContent.d.ts +141 -0
- package/es/date-picker/src/panel/use-calendar.d.ts +141 -0
- package/es/date-picker/src/panel/use-dual-calendar.d.ts +141 -0
- package/es/date-picker/src/panel/use-panel-common.d.ts +141 -0
- package/es/date-picker/styles/dark.js +3 -1
- package/es/date-picker/styles/light.d.ts +123 -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/dynamic-tags/src/DynamicTags.d.ts +30 -0
- package/es/dynamic-tags/styles/light.d.ts +3 -0
- package/es/infinite-scroll/src/InfiniteScroll.js +3 -6
- package/es/input/src/Input.d.ts +1 -1
- package/es/input-number/src/InputNumber.d.ts +1 -1
- package/es/legacy-transfer/src/Transfer.d.ts +1 -1
- 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/modal-fullscreen/index.d.ts +2 -0
- package/es/modal-fullscreen/index.js +1 -0
- package/es/modal-fullscreen/src/ModalFull.d.ts +953 -0
- package/es/modal-fullscreen/src/ModalFull.js +250 -0
- package/es/modal-fullscreen/src/interface.d.ts +0 -0
- package/es/modal-fullscreen/src/interface.js +1 -0
- package/es/modal-fullscreen/src/styles/index.cssr.d.ts +2 -0
- package/es/modal-fullscreen/src/styles/index.cssr.js +85 -0
- package/es/modal-fullscreen/styles/_common.d.ts +12 -0
- package/es/modal-fullscreen/styles/_common.js +11 -0
- package/es/modal-fullscreen/styles/dark.d.ts +3 -0
- package/es/modal-fullscreen/styles/dark.js +14 -0
- package/es/modal-fullscreen/styles/index.d.ts +3 -0
- package/es/modal-fullscreen/styles/index.js +2 -0
- package/es/modal-fullscreen/styles/light.d.ts +100 -0
- package/es/modal-fullscreen/styles/light.js +19 -0
- package/es/rate/src/Rate.d.ts +1 -1
- package/es/select/src/Select.d.ts +1 -1
- package/es/slider/src/Slider.d.ts +1 -1
- package/es/switch/src/Switch.d.ts +1 -1
- package/es/tag/index.d.ts +2 -0
- package/es/tag/index.js +1 -0
- package/es/tag/src/Tag.d.ts +40 -0
- package/es/tag/src/Tag.js +3 -0
- package/es/tag/src/TagGroup.d.ts +644 -0
- package/es/tag/src/TagGroup.js +109 -0
- package/es/tag/src/styles/index.cssr.d.ts +1 -0
- package/es/tag/src/styles/index.cssr.js +8 -1
- package/es/tag/styles/light.d.ts +3 -0
- package/es/tag/styles/light.js +5 -0
- package/es/themes/dark.js +5 -1
- package/es/themes/light.js +5 -1
- package/es/time-picker/src/TimePicker.d.ts +1 -1
- package/es/transfer/src/Transfer.d.ts +1 -1
- package/es/tree-select/src/TreeSelect.d.ts +1 -1
- package/es/version.d.ts +1 -1
- package/es/version.js +1 -1
- package/es/virtual-list/index.d.ts +1 -1
- package/es/virtual-list/index.js +1 -1
- package/lib/_internal/scrollbar/src/Scrollbar.js +19 -38
- package/lib/auto-complete/src/AutoComplete.d.ts +1 -1
- package/lib/cascader/src/Cascader.d.ts +1 -1
- package/lib/chat/index.d.ts +1 -1
- package/lib/chat/src/Chat.d.ts +233 -11
- package/lib/chat/src/Chat.js +73 -22
- 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/components.d.ts +2 -0
- package/lib/components.js +2 -0
- package/lib/config-provider/src/internal-interface.d.ts +4 -0
- package/lib/crop/index.d.ts +3 -0
- package/lib/crop/index.js +9 -0
- package/lib/crop/src/Crop.d.ts +222 -0
- package/lib/crop/src/Crop.js +163 -0
- package/lib/crop/src/interface.d.ts +6 -0
- package/lib/crop/src/interface.js +10 -0
- package/lib/crop/src/styles/index.cssr.d.ts +2 -0
- package/lib/crop/src/styles/index.cssr.js +338 -0
- package/lib/crop/styles/_common.d.ts +4 -0
- package/lib/crop/styles/_common.js +5 -0
- package/lib/crop/styles/dark.d.ts +3 -0
- package/lib/crop/styles/dark.js +11 -0
- package/lib/crop/styles/index.d.ts +3 -0
- package/lib/crop/styles/index.js +10 -0
- package/lib/crop/styles/light.d.ts +14 -0
- package/lib/crop/styles/light.js +21 -0
- package/lib/date-picker/src/DatePicker.d.ts +1308 -43
- 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 +141 -0
- package/lib/date-picker/src/panel/daterange.d.ts +141 -0
- package/lib/date-picker/src/panel/datetime.d.ts +141 -0
- package/lib/date-picker/src/panel/datetimerange.d.ts +141 -0
- package/lib/date-picker/src/panel/panelMonth.d.ts +283 -1
- package/lib/date-picker/src/panel/panelMonthContent.d.ts +141 -0
- package/lib/date-picker/src/panel/panelYear.d.ts +283 -1
- package/lib/date-picker/src/panel/panelYearContent.d.ts +141 -0
- package/lib/date-picker/src/panel/use-calendar.d.ts +141 -0
- package/lib/date-picker/src/panel/use-dual-calendar.d.ts +141 -0
- package/lib/date-picker/src/panel/use-panel-common.d.ts +141 -0
- package/lib/date-picker/styles/dark.js +3 -1
- package/lib/date-picker/styles/light.d.ts +123 -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/dynamic-tags/src/DynamicTags.d.ts +30 -0
- package/lib/dynamic-tags/styles/light.d.ts +3 -0
- package/lib/infinite-scroll/src/InfiniteScroll.js +3 -6
- package/lib/input/src/Input.d.ts +1 -1
- package/lib/input-number/src/InputNumber.d.ts +1 -1
- package/lib/legacy-transfer/src/Transfer.d.ts +1 -1
- 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/modal-fullscreen/index.d.ts +2 -0
- package/lib/modal-fullscreen/index.js +9 -0
- package/lib/modal-fullscreen/src/ModalFull.d.ts +953 -0
- package/lib/modal-fullscreen/src/ModalFull.js +256 -0
- package/lib/modal-fullscreen/src/interface.d.ts +0 -0
- package/lib/modal-fullscreen/src/interface.js +1 -0
- package/lib/modal-fullscreen/src/styles/index.cssr.d.ts +2 -0
- package/lib/modal-fullscreen/src/styles/index.cssr.js +90 -0
- package/lib/modal-fullscreen/styles/_common.d.ts +12 -0
- package/lib/modal-fullscreen/styles/_common.js +13 -0
- package/lib/modal-fullscreen/styles/dark.d.ts +3 -0
- package/lib/modal-fullscreen/styles/dark.js +16 -0
- package/lib/modal-fullscreen/styles/index.d.ts +3 -0
- package/lib/modal-fullscreen/styles/index.js +10 -0
- package/lib/modal-fullscreen/styles/light.d.ts +100 -0
- package/lib/modal-fullscreen/styles/light.js +26 -0
- package/lib/rate/src/Rate.d.ts +1 -1
- package/lib/select/src/Select.d.ts +1 -1
- package/lib/slider/src/Slider.d.ts +1 -1
- package/lib/switch/src/Switch.d.ts +1 -1
- package/lib/tag/index.d.ts +2 -0
- package/lib/tag/index.js +3 -1
- package/lib/tag/src/Tag.d.ts +40 -0
- package/lib/tag/src/Tag.js +3 -0
- package/lib/tag/src/TagGroup.d.ts +644 -0
- package/lib/tag/src/TagGroup.js +112 -0
- package/lib/tag/src/styles/index.cssr.d.ts +1 -0
- package/lib/tag/src/styles/index.cssr.js +9 -1
- package/lib/tag/styles/light.d.ts +3 -0
- package/lib/tag/styles/light.js +5 -0
- package/lib/themes/dark.js +5 -1
- package/lib/themes/light.js +5 -1
- package/lib/time-picker/src/TimePicker.d.ts +1 -1
- package/lib/transfer/src/Transfer.d.ts +1 -1
- package/lib/tree-select/src/TreeSelect.d.ts +1 -1
- package/lib/version.d.ts +1 -1
- package/lib/version.js +1 -1
- package/lib/virtual-list/index.d.ts +1 -1
- package/lib/virtual-list/index.js +2 -2
- package/package.json +4 -3
- package/volar.d.ts +4 -0
- package/web-types.json +472 -4
|
@@ -7,17 +7,46 @@ const vue_1 = require("vue");
|
|
|
7
7
|
const interface_1 = require("../interface");
|
|
8
8
|
const flex_1 = require("../../../flex");
|
|
9
9
|
const select_1 = require("../../../select");
|
|
10
|
+
const scrollbar_1 = require("../../../scrollbar");
|
|
10
11
|
const ChatListItems_1 = __importDefault(require("../ChatListItems"));
|
|
11
12
|
exports.default = (0, vue_1.defineComponent)({
|
|
12
13
|
name: 'ChatSidebar',
|
|
13
14
|
setup(props, { slots }) {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
const
|
|
18
|
-
const { mergedClsPrefixRef, mergedThemeRef, chatItemsRef, chatItemsLoadingRef, chatItemsLoadingCountRef, listEmptyPropsRef, selectedChatIdRef, typingChatIdsRef, typingTextRef, listItemAvatarPropsRef, listItemBadgePropsRef, notificationsShownSetRef, handleChatSelect
|
|
15
|
+
const sidebarContentRef = (0, vue_1.ref)();
|
|
16
|
+
const lastScrollTop = (0, vue_1.ref)(0);
|
|
17
|
+
const scrollTopFired = (0, vue_1.ref)(false);
|
|
18
|
+
const scrollBottomFired = (0, vue_1.ref)(false);
|
|
19
|
+
const { mergedClsPrefixRef, mergedThemeRef, chatItemsRef, chatItemsLoadingRef, chatItemsLoadingCountRef, listEmptyPropsRef, selectedChatIdRef, typingChatIdsRef, typingTextRef, listItemAvatarPropsRef, listItemBadgePropsRef, notificationsShownSetRef, handleChatSelect, onChatItemsScrollToTop, onChatItemsScrollToBottom
|
|
19
20
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
20
21
|
} = (0, vue_1.inject)(interface_1.chatInjectionKey);
|
|
22
|
+
const handleSidebarScroll = (e) => {
|
|
23
|
+
var _a, _b;
|
|
24
|
+
const target = e.target;
|
|
25
|
+
if (!target)
|
|
26
|
+
return;
|
|
27
|
+
const { scrollTop, scrollHeight, clientHeight } = target;
|
|
28
|
+
const threshold = 5;
|
|
29
|
+
const scrollDirection = scrollTop > lastScrollTop.value ? 'down' : 'up';
|
|
30
|
+
const nearTop = scrollTop <= threshold;
|
|
31
|
+
const nearBottom = scrollHeight - (scrollTop + clientHeight) <= threshold;
|
|
32
|
+
if (scrollTop > threshold) {
|
|
33
|
+
scrollTopFired.value = false;
|
|
34
|
+
}
|
|
35
|
+
if (scrollHeight - (scrollTop + clientHeight) > threshold) {
|
|
36
|
+
scrollBottomFired.value = false;
|
|
37
|
+
}
|
|
38
|
+
if (nearTop && scrollDirection === 'up' && !scrollTopFired.value) {
|
|
39
|
+
scrollTopFired.value = true;
|
|
40
|
+
(_a = onChatItemsScrollToTop === null || onChatItemsScrollToTop === void 0 ? void 0 : onChatItemsScrollToTop.value) === null || _a === void 0 ? void 0 : _a.call(onChatItemsScrollToTop);
|
|
41
|
+
}
|
|
42
|
+
if (nearBottom &&
|
|
43
|
+
scrollDirection === 'down' &&
|
|
44
|
+
!scrollBottomFired.value) {
|
|
45
|
+
scrollBottomFired.value = true;
|
|
46
|
+
(_b = onChatItemsScrollToBottom === null || onChatItemsScrollToBottom === void 0 ? void 0 : onChatItemsScrollToBottom.value) === null || _b === void 0 ? void 0 : _b.call(onChatItemsScrollToBottom);
|
|
47
|
+
}
|
|
48
|
+
lastScrollTop.value = scrollTop;
|
|
49
|
+
};
|
|
21
50
|
const renderListHeader = () => {
|
|
22
51
|
return ((0, vue_1.h)("div", { class: `${mergedClsPrefixRef.value}-chat-sidebar__header` },
|
|
23
52
|
(0, vue_1.h)(flex_1.UFlex, { align: "center", justify: "space-between", class: `${mergedClsPrefixRef.value}-chat-sidebar__header-container`, style: { width: '100%' } }, {
|
|
@@ -29,11 +58,33 @@ exports.default = (0, vue_1.defineComponent)({
|
|
|
29
58
|
}
|
|
30
59
|
})));
|
|
31
60
|
};
|
|
32
|
-
return
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
61
|
+
return {
|
|
62
|
+
slots,
|
|
63
|
+
sidebarContentRef,
|
|
64
|
+
renderListHeader,
|
|
65
|
+
handleSidebarScroll,
|
|
66
|
+
mergedClsPrefixRef,
|
|
67
|
+
mergedThemeRef,
|
|
68
|
+
chatItemsRef,
|
|
69
|
+
chatItemsLoadingRef,
|
|
70
|
+
chatItemsLoadingCountRef,
|
|
71
|
+
listEmptyPropsRef,
|
|
72
|
+
selectedChatIdRef,
|
|
73
|
+
typingChatIdsRef,
|
|
74
|
+
typingTextRef,
|
|
75
|
+
listItemAvatarPropsRef,
|
|
76
|
+
listItemBadgePropsRef,
|
|
77
|
+
notificationsShownSetRef,
|
|
78
|
+
handleChatSelect
|
|
79
|
+
};
|
|
80
|
+
},
|
|
81
|
+
render() {
|
|
82
|
+
return ((0, vue_1.h)("div", { class: `${this.mergedClsPrefixRef}-chat-sidebar` },
|
|
83
|
+
this.renderListHeader(),
|
|
84
|
+
(0, vue_1.h)(scrollbar_1.UScrollbar, { ref: "sidebarContentRef", class: `${this.mergedClsPrefixRef}-chat-sidebar__content`, onScroll: this.handleSidebarScroll }, {
|
|
85
|
+
default: () => ((0, vue_1.h)(ChatListItems_1.default, { chatItems: this.chatItemsRef, selectedChatId: this.selectedChatIdRef, typingChatIds: this.typingChatIdsRef, typingText: this.typingTextRef, loading: this.chatItemsLoadingRef, loadingCount: this.chatItemsLoadingCountRef, emptyProps: this.listEmptyPropsRef, avatarProps: this.listItemAvatarPropsRef, badgeProps: this.listItemBadgePropsRef, notificationsShown: this.notificationsShownSetRef, onChatSelect: this.handleChatSelect }, {
|
|
86
|
+
chatItemStatus: this.slots.chatItemStatus
|
|
87
|
+
}))
|
|
88
|
+
})));
|
|
38
89
|
}
|
|
39
90
|
});
|
|
@@ -137,6 +137,11 @@ export interface ChatProps {
|
|
|
137
137
|
unreadCount?: number;
|
|
138
138
|
headerButtonProps?: Partial<ButtonProps>;
|
|
139
139
|
headerIconProps?: Partial<IconProps>;
|
|
140
|
+
headerShareButtonProps?: Partial<ButtonProps>;
|
|
141
|
+
headerProfileButtonProps?: Partial<ButtonProps>;
|
|
142
|
+
headerCloseButtonProps?: Partial<ButtonProps>;
|
|
143
|
+
headerShareIconProps?: Partial<IconProps>;
|
|
144
|
+
headerProfileIconProps?: Partial<IconProps>;
|
|
140
145
|
messageSenderAvatarProps?: Partial<AvatarProps>;
|
|
141
146
|
messageUploadProps?: Partial<UploadProps>;
|
|
142
147
|
messageButtonProps?: Partial<ButtonProps>;
|
|
@@ -149,6 +154,8 @@ export interface ChatProps {
|
|
|
149
154
|
retryText?: string;
|
|
150
155
|
typingText?: string;
|
|
151
156
|
closeButtonText?: string;
|
|
157
|
+
shareButtonTooltip?: string;
|
|
158
|
+
profileButtonTooltip?: string;
|
|
152
159
|
unreadNotificationText?: string;
|
|
153
160
|
chatItemsLoading?: boolean;
|
|
154
161
|
chatItemsLoadingCount?: number;
|
|
@@ -159,10 +166,14 @@ export interface ChatProps {
|
|
|
159
166
|
onMessageRetry?: (message: ChatMessageData) => void;
|
|
160
167
|
onAttachmentUpload?: OnAttachmentUpload;
|
|
161
168
|
onFilterChange?: OnFilterChange;
|
|
162
|
-
|
|
169
|
+
onFooterInputChange?: (value: string, chatId: ChatId) => void;
|
|
163
170
|
onNetworkError?: OnNetworkError;
|
|
164
171
|
onUploadError?: OnUploadError;
|
|
165
172
|
onSendError?: OnSendError;
|
|
173
|
+
onChatItemsScrollToTop?: () => void;
|
|
174
|
+
onChatItemsScrollToBottom?: () => void;
|
|
175
|
+
onMessagesScrollToTop?: () => void;
|
|
176
|
+
onMessagesScrollToBottom?: () => void;
|
|
166
177
|
}
|
|
167
178
|
export interface ChatSlots {
|
|
168
179
|
header?: () => VNodeChild;
|
|
@@ -218,7 +229,6 @@ export type OnFilterChange = (filter: {
|
|
|
218
229
|
type: string;
|
|
219
230
|
value: any;
|
|
220
231
|
}) => void;
|
|
221
|
-
export type OnLoadMoreChats = (offset: number, limit: number) => void;
|
|
222
232
|
export type OnNetworkError = (error: {
|
|
223
233
|
code: string;
|
|
224
234
|
message: string;
|
|
@@ -274,6 +284,8 @@ export declare const chatInjectionKey: InjectionKey<{
|
|
|
274
284
|
retryTextRef: Ref<string>;
|
|
275
285
|
typingTextRef: Ref<string>;
|
|
276
286
|
closeButtonTextRef: Ref<string>;
|
|
287
|
+
shareButtonTooltipRef: Ref<string>;
|
|
288
|
+
profileButtonTooltipRef: Ref<string>;
|
|
277
289
|
unreadNotificationTextRef: Ref<string>;
|
|
278
290
|
notificationsShownSetRef: Ref<Set<ChatId>>;
|
|
279
291
|
unreadCountsBeforeReadRef: Ref<Record<ChatId, number>>;
|
|
@@ -281,12 +293,12 @@ export declare const chatInjectionKey: InjectionKey<{
|
|
|
281
293
|
handleChatSelect: (chatId: ChatId) => void;
|
|
282
294
|
handleMessageSend: (content: string, attachments?: ChatAttachment[]) => void;
|
|
283
295
|
handleMessageRetry: (message: ChatMessageData) => void;
|
|
296
|
+
handleFooterInputChange: (value: string, chatId: ChatId) => void;
|
|
284
297
|
markMessagesAsRead?: (chatId: ChatId) => void;
|
|
285
298
|
handleFilterChange: (filter: {
|
|
286
299
|
type: string;
|
|
287
300
|
value: string | number | boolean;
|
|
288
301
|
}) => void;
|
|
289
|
-
handleLoadMoreChats: (offset: number, limit: number) => void;
|
|
290
302
|
handleNetworkError: (error: {
|
|
291
303
|
code: string;
|
|
292
304
|
message: string;
|
|
@@ -302,4 +314,13 @@ export declare const chatInjectionKey: InjectionKey<{
|
|
|
302
314
|
onChatClose?: Ref<(() => void) | undefined>;
|
|
303
315
|
onChatShare?: Ref<(() => void) | undefined>;
|
|
304
316
|
onUserProfile?: Ref<(() => void) | undefined>;
|
|
317
|
+
onChatItemsScrollToTop?: Ref<(() => void) | undefined>;
|
|
318
|
+
onChatItemsScrollToBottom?: Ref<(() => void) | undefined>;
|
|
319
|
+
onMessagesScrollToTop?: Ref<(() => void) | undefined>;
|
|
320
|
+
onMessagesScrollToBottom?: Ref<(() => void) | undefined>;
|
|
321
|
+
headerShareButtonPropsRef: Ref<Partial<ButtonProps> | undefined>;
|
|
322
|
+
headerProfileButtonPropsRef: Ref<Partial<ButtonProps> | undefined>;
|
|
323
|
+
headerCloseButtonPropsRef: Ref<Partial<ButtonProps> | undefined>;
|
|
324
|
+
headerShareIconPropsRef: Ref<Partial<IconProps> | undefined>;
|
|
325
|
+
headerProfileIconPropsRef: Ref<Partial<IconProps> | undefined>;
|
|
305
326
|
}>;
|
|
@@ -41,11 +41,11 @@ exports.default = (0, cssr_1.cB)('chat', `
|
|
|
41
41
|
gap: 8px;
|
|
42
42
|
`), (0, cssr_1.cE)('content', `
|
|
43
43
|
flex: 1;
|
|
44
|
-
overflow-y: auto;
|
|
45
44
|
min-height: 0;
|
|
45
|
+
`, [(0, cssr_1.c)('.u-scrollbar-content', `
|
|
46
46
|
padding: 16px;
|
|
47
47
|
padding-top: 8px;
|
|
48
|
-
`), (0, cssr_1.cE)('item', `
|
|
48
|
+
`)]), (0, cssr_1.cE)('item', `
|
|
49
49
|
padding: 12px 16px;
|
|
50
50
|
width: 100%;
|
|
51
51
|
cursor: pointer;
|
|
@@ -167,8 +167,19 @@ exports.default = (0, cssr_1.cB)('chat', `
|
|
|
167
167
|
`), (0, cssr_1.cE)('header-title', `
|
|
168
168
|
margin-top: 9px;
|
|
169
169
|
color: var(--u-header-title-color);
|
|
170
|
+
flex: 1;
|
|
171
|
+
min-width: 0;
|
|
172
|
+
overflow: hidden;
|
|
173
|
+
text-overflow: ellipsis;
|
|
174
|
+
white-space: nowrap;
|
|
175
|
+
display: block;
|
|
176
|
+
margin-right: 16px;
|
|
170
177
|
`), (0, cssr_1.cE)('header-actions', `
|
|
171
178
|
padding: 4px;
|
|
179
|
+
flex-shrink: 0;
|
|
180
|
+
display: flex;
|
|
181
|
+
align-items: center;
|
|
182
|
+
gap: 8px;
|
|
172
183
|
`), (0, cssr_1.cE)('unread-notification', `
|
|
173
184
|
background-color: var(--u-unread-notification-background-color);
|
|
174
185
|
color: var(--u-unread-notification-text-color);
|
package/lib/components.d.ts
CHANGED
|
@@ -57,6 +57,7 @@ export * from './menu';
|
|
|
57
57
|
export * from './mention';
|
|
58
58
|
export * from './message';
|
|
59
59
|
export * from './modal';
|
|
60
|
+
export * from './modal-fullscreen';
|
|
60
61
|
export * from './notification';
|
|
61
62
|
export * from './page-header';
|
|
62
63
|
export * from './pagination';
|
|
@@ -96,3 +97,4 @@ export * from './discrete';
|
|
|
96
97
|
export * from './equation';
|
|
97
98
|
export * from './toggle-button';
|
|
98
99
|
export * from './flex';
|
|
100
|
+
export * from './crop';
|
package/lib/components.js
CHANGED
|
@@ -73,6 +73,7 @@ __exportStar(require("./menu"), exports);
|
|
|
73
73
|
__exportStar(require("./mention"), exports);
|
|
74
74
|
__exportStar(require("./message"), exports);
|
|
75
75
|
__exportStar(require("./modal"), exports);
|
|
76
|
+
__exportStar(require("./modal-fullscreen"), exports);
|
|
76
77
|
__exportStar(require("./notification"), exports);
|
|
77
78
|
__exportStar(require("./page-header"), exports);
|
|
78
79
|
__exportStar(require("./pagination"), exports);
|
|
@@ -112,3 +113,4 @@ __exportStar(require("./discrete"), exports);
|
|
|
112
113
|
__exportStar(require("./equation"), exports);
|
|
113
114
|
__exportStar(require("./toggle-button"), exports);
|
|
114
115
|
__exportStar(require("./flex"), exports);
|
|
116
|
+
__exportStar(require("./crop"), exports);
|
|
@@ -102,6 +102,8 @@ import type { FlexTheme } from '../../flex/styles';
|
|
|
102
102
|
import { CardListTheme } from '../../card-list/styles';
|
|
103
103
|
import { ActionCardTheme } from '../../action-card';
|
|
104
104
|
import { ChatTheme } from '../../chat/styles';
|
|
105
|
+
import { ModalFullscreenTheme } from '../../modal-fullscreen/styles';
|
|
106
|
+
import { CropTheme } from '../../crop/styles';
|
|
105
107
|
export interface GlobalThemeWithoutCommon {
|
|
106
108
|
Alert?: AlertTheme;
|
|
107
109
|
Anchor?: AnchorTheme;
|
|
@@ -190,6 +192,8 @@ export interface GlobalThemeWithoutCommon {
|
|
|
190
192
|
Flex?: FlexTheme;
|
|
191
193
|
CardList?: CardListTheme;
|
|
192
194
|
Chat?: ChatTheme;
|
|
195
|
+
ModalFullscreen?: ModalFullscreenTheme;
|
|
196
|
+
Crop?: CropTheme;
|
|
193
197
|
InternalSelectMenu?: InternalSelectMenuTheme;
|
|
194
198
|
InternalSelection?: InternalSelectionTheme;
|
|
195
199
|
AccountOption?: AccountOptionTheme;
|
|
@@ -0,0 +1,9 @@
|
|
|
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.cropProps = exports.UCrop = void 0;
|
|
7
|
+
var Crop_1 = require("./src/Crop");
|
|
8
|
+
Object.defineProperty(exports, "UCrop", { enumerable: true, get: function () { return __importDefault(Crop_1).default; } });
|
|
9
|
+
Object.defineProperty(exports, "cropProps", { enumerable: true, get: function () { return Crop_1.cropProps; } });
|
|
@@ -0,0 +1,222 @@
|
|
|
1
|
+
import { PropType } from 'vue';
|
|
2
|
+
import { ExtractPublicPropTypes } from '../../_utils';
|
|
3
|
+
import { ViewMode } from './interface';
|
|
4
|
+
export declare const cropProps: {
|
|
5
|
+
src: StringConstructor;
|
|
6
|
+
wrapperWidth: {
|
|
7
|
+
type: (StringConstructor | NumberConstructor)[];
|
|
8
|
+
default: string;
|
|
9
|
+
};
|
|
10
|
+
wrapperHeight: {
|
|
11
|
+
type: (StringConstructor | NumberConstructor)[];
|
|
12
|
+
default: string;
|
|
13
|
+
};
|
|
14
|
+
viewMode: {
|
|
15
|
+
type: PropType<ViewMode>;
|
|
16
|
+
default: number;
|
|
17
|
+
};
|
|
18
|
+
dragMode: {
|
|
19
|
+
type: PropType<"crop" | "move" | "none">;
|
|
20
|
+
default: string;
|
|
21
|
+
};
|
|
22
|
+
aspectRatio: {
|
|
23
|
+
type: NumberConstructor;
|
|
24
|
+
default: number;
|
|
25
|
+
};
|
|
26
|
+
background: {
|
|
27
|
+
type: BooleanConstructor;
|
|
28
|
+
default: boolean;
|
|
29
|
+
};
|
|
30
|
+
circleShape: {
|
|
31
|
+
type: BooleanConstructor;
|
|
32
|
+
default: boolean;
|
|
33
|
+
};
|
|
34
|
+
zoomable: {
|
|
35
|
+
type: BooleanConstructor;
|
|
36
|
+
default: boolean;
|
|
37
|
+
};
|
|
38
|
+
cropperThemeColor: {
|
|
39
|
+
type: StringConstructor;
|
|
40
|
+
default: string;
|
|
41
|
+
};
|
|
42
|
+
cancelButtonText: {
|
|
43
|
+
type: StringConstructor;
|
|
44
|
+
default: string;
|
|
45
|
+
};
|
|
46
|
+
confirmButtonText: {
|
|
47
|
+
type: StringConstructor;
|
|
48
|
+
default: string;
|
|
49
|
+
};
|
|
50
|
+
theme: PropType<import("../../_mixins").Theme<"Crop", {
|
|
51
|
+
wrapperBg: string;
|
|
52
|
+
wrapperBorderRadius: string;
|
|
53
|
+
wrapperMargin: string;
|
|
54
|
+
}, {}>>;
|
|
55
|
+
themeOverrides: PropType<import("../../_mixins/use-theme").ExtractThemeOverrides<import("../../_mixins").Theme<"Crop", {
|
|
56
|
+
wrapperBg: string;
|
|
57
|
+
wrapperBorderRadius: string;
|
|
58
|
+
wrapperMargin: string;
|
|
59
|
+
}, {}>>>;
|
|
60
|
+
builtinThemeOverrides: PropType<import("../../_mixins/use-theme").ExtractThemeOverrides<import("../../_mixins").Theme<"Crop", {
|
|
61
|
+
wrapperBg: string;
|
|
62
|
+
wrapperBorderRadius: string;
|
|
63
|
+
wrapperMargin: string;
|
|
64
|
+
}, {}>>>;
|
|
65
|
+
};
|
|
66
|
+
export type CropProps = ExtractPublicPropTypes<typeof cropProps>;
|
|
67
|
+
declare const _default: import("vue").DefineComponent<{
|
|
68
|
+
src: StringConstructor;
|
|
69
|
+
wrapperWidth: {
|
|
70
|
+
type: (StringConstructor | NumberConstructor)[];
|
|
71
|
+
default: string;
|
|
72
|
+
};
|
|
73
|
+
wrapperHeight: {
|
|
74
|
+
type: (StringConstructor | NumberConstructor)[];
|
|
75
|
+
default: string;
|
|
76
|
+
};
|
|
77
|
+
viewMode: {
|
|
78
|
+
type: PropType<ViewMode>;
|
|
79
|
+
default: number;
|
|
80
|
+
};
|
|
81
|
+
dragMode: {
|
|
82
|
+
type: PropType<"crop" | "move" | "none">;
|
|
83
|
+
default: string;
|
|
84
|
+
};
|
|
85
|
+
aspectRatio: {
|
|
86
|
+
type: NumberConstructor;
|
|
87
|
+
default: number;
|
|
88
|
+
};
|
|
89
|
+
background: {
|
|
90
|
+
type: BooleanConstructor;
|
|
91
|
+
default: boolean;
|
|
92
|
+
};
|
|
93
|
+
circleShape: {
|
|
94
|
+
type: BooleanConstructor;
|
|
95
|
+
default: boolean;
|
|
96
|
+
};
|
|
97
|
+
zoomable: {
|
|
98
|
+
type: BooleanConstructor;
|
|
99
|
+
default: boolean;
|
|
100
|
+
};
|
|
101
|
+
cropperThemeColor: {
|
|
102
|
+
type: StringConstructor;
|
|
103
|
+
default: string;
|
|
104
|
+
};
|
|
105
|
+
cancelButtonText: {
|
|
106
|
+
type: StringConstructor;
|
|
107
|
+
default: string;
|
|
108
|
+
};
|
|
109
|
+
confirmButtonText: {
|
|
110
|
+
type: StringConstructor;
|
|
111
|
+
default: string;
|
|
112
|
+
};
|
|
113
|
+
theme: PropType<import("../../_mixins").Theme<"Crop", {
|
|
114
|
+
wrapperBg: string;
|
|
115
|
+
wrapperBorderRadius: string;
|
|
116
|
+
wrapperMargin: string;
|
|
117
|
+
}, {}>>;
|
|
118
|
+
themeOverrides: PropType<import("../../_mixins/use-theme").ExtractThemeOverrides<import("../../_mixins").Theme<"Crop", {
|
|
119
|
+
wrapperBg: string;
|
|
120
|
+
wrapperBorderRadius: string;
|
|
121
|
+
wrapperMargin: string;
|
|
122
|
+
}, {}>>>;
|
|
123
|
+
builtinThemeOverrides: PropType<import("../../_mixins/use-theme").ExtractThemeOverrides<import("../../_mixins").Theme<"Crop", {
|
|
124
|
+
wrapperBg: string;
|
|
125
|
+
wrapperBorderRadius: string;
|
|
126
|
+
wrapperMargin: string;
|
|
127
|
+
}, {}>>>;
|
|
128
|
+
}, {
|
|
129
|
+
cropWrapperRef: import("vue").Ref<HTMLDivElement | undefined>;
|
|
130
|
+
cropImageRef: import("vue").Ref<HTMLImageElement | undefined>;
|
|
131
|
+
mergedClsPrefix: import("vue").Ref<string>;
|
|
132
|
+
cssVars: import("vue").ComputedRef<{
|
|
133
|
+
'--u-wrapper-border-radius': string;
|
|
134
|
+
'--u-wrapper-bg-color': string;
|
|
135
|
+
'--u-wrapper-width': string;
|
|
136
|
+
'--u-wrapper-height': string;
|
|
137
|
+
'--u-cropper-theme-color': string;
|
|
138
|
+
'--u-wrapper-margin': string;
|
|
139
|
+
}>;
|
|
140
|
+
confirmCrop: () => void;
|
|
141
|
+
cancelCrop: () => void;
|
|
142
|
+
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
143
|
+
cancel: () => true;
|
|
144
|
+
confirm: (dataUrl: string) => true;
|
|
145
|
+
}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
|
|
146
|
+
src: StringConstructor;
|
|
147
|
+
wrapperWidth: {
|
|
148
|
+
type: (StringConstructor | NumberConstructor)[];
|
|
149
|
+
default: string;
|
|
150
|
+
};
|
|
151
|
+
wrapperHeight: {
|
|
152
|
+
type: (StringConstructor | NumberConstructor)[];
|
|
153
|
+
default: string;
|
|
154
|
+
};
|
|
155
|
+
viewMode: {
|
|
156
|
+
type: PropType<ViewMode>;
|
|
157
|
+
default: number;
|
|
158
|
+
};
|
|
159
|
+
dragMode: {
|
|
160
|
+
type: PropType<"crop" | "move" | "none">;
|
|
161
|
+
default: string;
|
|
162
|
+
};
|
|
163
|
+
aspectRatio: {
|
|
164
|
+
type: NumberConstructor;
|
|
165
|
+
default: number;
|
|
166
|
+
};
|
|
167
|
+
background: {
|
|
168
|
+
type: BooleanConstructor;
|
|
169
|
+
default: boolean;
|
|
170
|
+
};
|
|
171
|
+
circleShape: {
|
|
172
|
+
type: BooleanConstructor;
|
|
173
|
+
default: boolean;
|
|
174
|
+
};
|
|
175
|
+
zoomable: {
|
|
176
|
+
type: BooleanConstructor;
|
|
177
|
+
default: boolean;
|
|
178
|
+
};
|
|
179
|
+
cropperThemeColor: {
|
|
180
|
+
type: StringConstructor;
|
|
181
|
+
default: string;
|
|
182
|
+
};
|
|
183
|
+
cancelButtonText: {
|
|
184
|
+
type: StringConstructor;
|
|
185
|
+
default: string;
|
|
186
|
+
};
|
|
187
|
+
confirmButtonText: {
|
|
188
|
+
type: StringConstructor;
|
|
189
|
+
default: string;
|
|
190
|
+
};
|
|
191
|
+
theme: PropType<import("../../_mixins").Theme<"Crop", {
|
|
192
|
+
wrapperBg: string;
|
|
193
|
+
wrapperBorderRadius: string;
|
|
194
|
+
wrapperMargin: string;
|
|
195
|
+
}, {}>>;
|
|
196
|
+
themeOverrides: PropType<import("../../_mixins/use-theme").ExtractThemeOverrides<import("../../_mixins").Theme<"Crop", {
|
|
197
|
+
wrapperBg: string;
|
|
198
|
+
wrapperBorderRadius: string;
|
|
199
|
+
wrapperMargin: string;
|
|
200
|
+
}, {}>>>;
|
|
201
|
+
builtinThemeOverrides: PropType<import("../../_mixins/use-theme").ExtractThemeOverrides<import("../../_mixins").Theme<"Crop", {
|
|
202
|
+
wrapperBg: string;
|
|
203
|
+
wrapperBorderRadius: string;
|
|
204
|
+
wrapperMargin: string;
|
|
205
|
+
}, {}>>>;
|
|
206
|
+
}>> & {
|
|
207
|
+
onConfirm?: ((dataUrl: string) => any) | undefined;
|
|
208
|
+
onCancel?: (() => any) | undefined;
|
|
209
|
+
}, {
|
|
210
|
+
aspectRatio: number;
|
|
211
|
+
background: boolean;
|
|
212
|
+
wrapperWidth: string | number;
|
|
213
|
+
wrapperHeight: string | number;
|
|
214
|
+
viewMode: ViewMode;
|
|
215
|
+
dragMode: "none" | "move" | "crop";
|
|
216
|
+
circleShape: boolean;
|
|
217
|
+
zoomable: boolean;
|
|
218
|
+
cropperThemeColor: string;
|
|
219
|
+
cancelButtonText: string;
|
|
220
|
+
confirmButtonText: string;
|
|
221
|
+
}, {}>;
|
|
222
|
+
export default _default;
|
|
@@ -0,0 +1,163 @@
|
|
|
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.cropProps = void 0;
|
|
7
|
+
const vue_1 = require("vue");
|
|
8
|
+
const cropperjs_1 = __importDefault(require("cropperjs"));
|
|
9
|
+
const index_cssr_1 = __importDefault(require("./styles/index.cssr"));
|
|
10
|
+
const _mixins_1 = require("../../_mixins");
|
|
11
|
+
const styles_1 = require("../styles");
|
|
12
|
+
const button_1 = require("../../button");
|
|
13
|
+
const flex_1 = require("../../flex");
|
|
14
|
+
exports.cropProps = Object.assign(Object.assign({}, _mixins_1.useTheme.props), { src: String, wrapperWidth: {
|
|
15
|
+
type: [Number, String],
|
|
16
|
+
default: 'auto'
|
|
17
|
+
}, wrapperHeight: {
|
|
18
|
+
type: [Number, String],
|
|
19
|
+
default: 'auto'
|
|
20
|
+
}, viewMode: {
|
|
21
|
+
type: Number,
|
|
22
|
+
default: 0
|
|
23
|
+
}, dragMode: {
|
|
24
|
+
type: String,
|
|
25
|
+
default: 'none'
|
|
26
|
+
}, aspectRatio: {
|
|
27
|
+
type: Number,
|
|
28
|
+
default: NaN
|
|
29
|
+
}, background: {
|
|
30
|
+
type: Boolean,
|
|
31
|
+
default: true
|
|
32
|
+
}, circleShape: {
|
|
33
|
+
type: Boolean,
|
|
34
|
+
default: false
|
|
35
|
+
}, zoomable: {
|
|
36
|
+
type: Boolean,
|
|
37
|
+
default: false
|
|
38
|
+
}, cropperThemeColor: {
|
|
39
|
+
type: String,
|
|
40
|
+
default: '#fff'
|
|
41
|
+
}, cancelButtonText: {
|
|
42
|
+
type: String,
|
|
43
|
+
default: 'Cancel'
|
|
44
|
+
}, confirmButtonText: {
|
|
45
|
+
type: String,
|
|
46
|
+
default: 'Save'
|
|
47
|
+
} });
|
|
48
|
+
exports.default = (0, vue_1.defineComponent)({
|
|
49
|
+
name: 'Crop',
|
|
50
|
+
inheritAttrs: false,
|
|
51
|
+
props: exports.cropProps,
|
|
52
|
+
emits: {
|
|
53
|
+
cancel: () => true,
|
|
54
|
+
confirm: (dataUrl) => true
|
|
55
|
+
},
|
|
56
|
+
setup(props, { emit }) {
|
|
57
|
+
const cropWrapperRef = (0, vue_1.ref)();
|
|
58
|
+
const cropImageRef = (0, vue_1.ref)();
|
|
59
|
+
const cropperInstance = (0, vue_1.ref)(null);
|
|
60
|
+
const { mergedClsPrefixRef } = (0, _mixins_1.useConfig)(props);
|
|
61
|
+
const themeRef = (0, _mixins_1.useTheme)('Crop', '-crop', index_cssr_1.default, styles_1.cropLight, props, mergedClsPrefixRef);
|
|
62
|
+
const cssVarsRef = (0, vue_1.computed)(() => {
|
|
63
|
+
const width = typeof props.wrapperWidth === 'string'
|
|
64
|
+
? props.wrapperWidth.endsWith('px')
|
|
65
|
+
? props.wrapperWidth
|
|
66
|
+
: `${props.wrapperWidth}px`
|
|
67
|
+
: `${props.wrapperWidth}px`;
|
|
68
|
+
const height = typeof props.wrapperHeight === 'string'
|
|
69
|
+
? props.wrapperHeight.endsWith('px')
|
|
70
|
+
? props.wrapperHeight
|
|
71
|
+
: `${props.wrapperHeight}px`
|
|
72
|
+
: `${props.wrapperHeight}px`;
|
|
73
|
+
const { self: { wrapperBorderRadius, wrapperBg, wrapperMargin } } = themeRef.value;
|
|
74
|
+
return {
|
|
75
|
+
'--u-wrapper-border-radius': wrapperBorderRadius,
|
|
76
|
+
'--u-wrapper-bg-color': wrapperBg,
|
|
77
|
+
'--u-wrapper-width': width,
|
|
78
|
+
'--u-wrapper-height': height,
|
|
79
|
+
'--u-cropper-theme-color': props.cropperThemeColor,
|
|
80
|
+
'--u-wrapper-margin': wrapperMargin
|
|
81
|
+
};
|
|
82
|
+
});
|
|
83
|
+
const initCrop = () => {
|
|
84
|
+
if (cropperInstance.value) {
|
|
85
|
+
destroyCrop();
|
|
86
|
+
}
|
|
87
|
+
if (props.src && cropWrapperRef.value && cropImageRef.value) {
|
|
88
|
+
cropperInstance.value = new cropperjs_1.default(cropImageRef.value, {
|
|
89
|
+
viewMode: props.viewMode,
|
|
90
|
+
dragMode: props.dragMode,
|
|
91
|
+
aspectRatio: props.aspectRatio,
|
|
92
|
+
background: props.background,
|
|
93
|
+
guides: false,
|
|
94
|
+
center: false,
|
|
95
|
+
zoomable: props.zoomable
|
|
96
|
+
});
|
|
97
|
+
}
|
|
98
|
+
};
|
|
99
|
+
const destroyCrop = () => {
|
|
100
|
+
var _a;
|
|
101
|
+
(_a = cropperInstance.value) === null || _a === void 0 ? void 0 : _a.destroy();
|
|
102
|
+
cropperInstance.value = null;
|
|
103
|
+
};
|
|
104
|
+
const confirmCrop = () => {
|
|
105
|
+
var _a;
|
|
106
|
+
const sourceCanvas = (_a = cropperInstance.value) === null || _a === void 0 ? void 0 : _a.getCroppedCanvas();
|
|
107
|
+
if (sourceCanvas) {
|
|
108
|
+
if (props.circleShape) {
|
|
109
|
+
const canvas = document.createElement('canvas');
|
|
110
|
+
const context = canvas.getContext('2d');
|
|
111
|
+
if (context) {
|
|
112
|
+
const width = sourceCanvas.width;
|
|
113
|
+
const height = sourceCanvas.height;
|
|
114
|
+
canvas.width = width;
|
|
115
|
+
canvas.height = height;
|
|
116
|
+
context.imageSmoothingEnabled = true;
|
|
117
|
+
context.drawImage(sourceCanvas, 0, 0, width, height);
|
|
118
|
+
context.globalCompositeOperation = 'destination-in';
|
|
119
|
+
context.beginPath();
|
|
120
|
+
context.arc(width / 2, height / 2, Math.min(width, height) / 2, 0, 2 * Math.PI, true);
|
|
121
|
+
context.fill();
|
|
122
|
+
emit('confirm', canvas.toDataURL());
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
else {
|
|
126
|
+
emit('confirm', sourceCanvas.toDataURL());
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
};
|
|
130
|
+
const cancelCrop = () => {
|
|
131
|
+
emit('cancel');
|
|
132
|
+
};
|
|
133
|
+
(0, vue_1.watch)(props, initCrop);
|
|
134
|
+
(0, vue_1.onMounted)(initCrop);
|
|
135
|
+
(0, vue_1.onBeforeUnmount)(destroyCrop);
|
|
136
|
+
return {
|
|
137
|
+
cropWrapperRef,
|
|
138
|
+
cropImageRef,
|
|
139
|
+
mergedClsPrefix: mergedClsPrefixRef,
|
|
140
|
+
cssVars: cssVarsRef,
|
|
141
|
+
confirmCrop,
|
|
142
|
+
cancelCrop
|
|
143
|
+
};
|
|
144
|
+
},
|
|
145
|
+
render() {
|
|
146
|
+
const { src, cssVars, circleShape, mergedClsPrefix, cancelButtonText, confirmButtonText, confirmCrop, cancelCrop } = this;
|
|
147
|
+
return ((0, vue_1.h)("div", { style: cssVars },
|
|
148
|
+
(0, vue_1.h)("div", { ref: "cropWrapperRef", class: [
|
|
149
|
+
`${mergedClsPrefix}-crop-wrapper`,
|
|
150
|
+
circleShape ? `${mergedClsPrefix}-crop-wrapper--circle` : null
|
|
151
|
+
] },
|
|
152
|
+
(0, vue_1.h)("img", { ref: "cropImageRef", src: src, class: `${mergedClsPrefix}-crop-img` })),
|
|
153
|
+
(0, vue_1.h)(flex_1.UFlex, { justify: "end" }, {
|
|
154
|
+
default: () => ((0, vue_1.h)(vue_1.Fragment, null,
|
|
155
|
+
(0, vue_1.h)(button_1.UButton, { secondary: true, onClick: cancelCrop }, {
|
|
156
|
+
default: () => cancelButtonText
|
|
157
|
+
}),
|
|
158
|
+
(0, vue_1.h)(button_1.UButton, { tertiary: true, onClick: confirmCrop }, {
|
|
159
|
+
default: () => confirmButtonText
|
|
160
|
+
})))
|
|
161
|
+
})));
|
|
162
|
+
}
|
|
163
|
+
});
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ViewMode = void 0;
|
|
4
|
+
var ViewMode;
|
|
5
|
+
(function (ViewMode) {
|
|
6
|
+
ViewMode[ViewMode["v0"] = 0] = "v0";
|
|
7
|
+
ViewMode[ViewMode["v1"] = 1] = "v1";
|
|
8
|
+
ViewMode[ViewMode["v2"] = 2] = "v2";
|
|
9
|
+
ViewMode[ViewMode["v3"] = 3] = "v3";
|
|
10
|
+
})(ViewMode || (exports.ViewMode = ViewMode = {}));
|