@uzum-tech/ui 1.10.0 → 1.11.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 +1269 -207
- package/dist/index.prod.js +3 -3
- package/es/_internal/index.d.ts +2 -0
- package/es/_internal/index.js +1 -0
- package/es/_internal/safe-top-scrollbar/index.d.ts +2 -0
- package/es/_internal/safe-top-scrollbar/index.js +1 -0
- package/es/_internal/safe-top-scrollbar/src/SafeTopScrollbar.d.ts +356 -0
- package/es/_internal/safe-top-scrollbar/src/SafeTopScrollbar.js +708 -0
- package/es/_internal/safe-top-scrollbar/src/styles/index.cssr.d.ts +2 -0
- package/es/_internal/safe-top-scrollbar/src/styles/index.cssr.js +80 -0
- package/es/_internal/safe-top-scrollbar/src/styles/rtl.cssr.d.ts +2 -0
- package/es/_internal/safe-top-scrollbar/src/styles/rtl.cssr.js +10 -0
- package/es/_internal/safe-top-scrollbar/styles/common.d.ts +7 -0
- package/es/_internal/safe-top-scrollbar/styles/common.js +7 -0
- package/es/_internal/safe-top-scrollbar/styles/dark.d.ts +3 -0
- package/es/_internal/safe-top-scrollbar/styles/dark.js +8 -0
- package/es/_internal/safe-top-scrollbar/styles/index.d.ts +4 -0
- package/es/_internal/safe-top-scrollbar/styles/index.js +3 -0
- package/es/_internal/safe-top-scrollbar/styles/light.d.ts +18 -0
- package/es/_internal/safe-top-scrollbar/styles/light.js +12 -0
- package/es/_internal/safe-top-scrollbar/styles/rtl.d.ts +3 -0
- package/es/_internal/safe-top-scrollbar/styles/rtl.js +6 -0
- package/es/chat/src/Chat.d.ts +14 -1
- package/es/chat/src/Chat.js +5 -0
- package/es/chat/src/ChatListItems.js +16 -1
- package/es/chat/src/ChatParts/ChatAttachment.js +31 -3
- package/es/chat/src/ChatParts/MainArea.js +68 -62
- package/es/chat/src/interface.d.ts +6 -2
- package/es/components.d.ts +1 -0
- package/es/components.js +1 -0
- package/es/config-provider/src/internal-interface.d.ts +2 -0
- package/es/drawer/src/Drawer.d.ts +18 -0
- package/es/drawer/src/Drawer.js +28 -26
- package/es/drawer/src/DrawerBodyWrapper.d.ts +8 -0
- package/es/drawer/src/DrawerBodyWrapper.js +36 -8
- package/es/infinite-scroll/src/InfiniteScroll.d.ts +16 -0
- package/es/infinite-scroll/src/InfiniteScroll.js +48 -12
- package/es/safe-top-scrollbar/index.d.ts +2 -0
- package/es/safe-top-scrollbar/index.js +1 -0
- package/es/safe-top-scrollbar/src/SafeTopScrollbar.d.ts +177 -0
- package/es/safe-top-scrollbar/src/SafeTopScrollbar.js +38 -0
- package/es/themes/dark.js +2 -0
- package/es/themes/light.js +2 -0
- package/es/version.d.ts +1 -1
- package/es/version.js +1 -1
- package/lib/_internal/index.d.ts +2 -0
- package/lib/_internal/index.js +4 -1
- package/lib/_internal/safe-top-scrollbar/index.d.ts +2 -0
- package/lib/_internal/safe-top-scrollbar/index.js +9 -0
- package/lib/_internal/safe-top-scrollbar/src/SafeTopScrollbar.d.ts +356 -0
- package/lib/_internal/safe-top-scrollbar/src/SafeTopScrollbar.js +714 -0
- package/lib/_internal/safe-top-scrollbar/src/styles/index.cssr.d.ts +2 -0
- package/lib/_internal/safe-top-scrollbar/src/styles/index.cssr.js +85 -0
- package/lib/_internal/safe-top-scrollbar/src/styles/rtl.cssr.d.ts +2 -0
- package/lib/_internal/safe-top-scrollbar/src/styles/rtl.cssr.js +15 -0
- package/lib/_internal/safe-top-scrollbar/styles/common.d.ts +7 -0
- package/lib/_internal/safe-top-scrollbar/styles/common.js +10 -0
- package/lib/_internal/safe-top-scrollbar/styles/dark.d.ts +3 -0
- package/lib/_internal/safe-top-scrollbar/styles/dark.js +10 -0
- package/lib/_internal/safe-top-scrollbar/styles/index.d.ts +4 -0
- package/lib/_internal/safe-top-scrollbar/styles/index.js +12 -0
- package/lib/_internal/safe-top-scrollbar/styles/light.d.ts +18 -0
- package/lib/_internal/safe-top-scrollbar/styles/light.js +16 -0
- package/lib/_internal/safe-top-scrollbar/styles/rtl.d.ts +3 -0
- package/lib/_internal/safe-top-scrollbar/styles/rtl.js +12 -0
- package/lib/chat/src/Chat.d.ts +14 -1
- package/lib/chat/src/Chat.js +5 -0
- package/lib/chat/src/ChatListItems.js +16 -1
- package/lib/chat/src/ChatParts/ChatAttachment.js +30 -2
- package/lib/chat/src/ChatParts/MainArea.js +68 -62
- package/lib/chat/src/interface.d.ts +6 -2
- package/lib/components.d.ts +1 -0
- package/lib/components.js +1 -0
- package/lib/config-provider/src/internal-interface.d.ts +2 -0
- package/lib/drawer/src/Drawer.d.ts +18 -0
- package/lib/drawer/src/Drawer.js +28 -26
- package/lib/drawer/src/DrawerBodyWrapper.d.ts +8 -0
- package/lib/drawer/src/DrawerBodyWrapper.js +36 -8
- package/lib/infinite-scroll/src/InfiniteScroll.d.ts +16 -0
- package/lib/infinite-scroll/src/InfiniteScroll.js +47 -11
- package/lib/safe-top-scrollbar/index.d.ts +2 -0
- package/lib/safe-top-scrollbar/index.js +9 -0
- package/lib/safe-top-scrollbar/src/SafeTopScrollbar.d.ts +177 -0
- package/lib/safe-top-scrollbar/src/SafeTopScrollbar.js +41 -0
- package/lib/themes/dark.js +5 -0
- package/lib/themes/light.js +5 -0
- package/lib/version.d.ts +1 -1
- package/lib/version.js +1 -1
- package/package.json +6 -6
- package/volar.d.ts +1 -0
- package/web-types.json +67 -2
|
@@ -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
|
|
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
|
|
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>;
|
package/lib/components.d.ts
CHANGED
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>>;
|
package/lib/drawer/src/Drawer.js
CHANGED
|
@@ -57,7 +57,11 @@ exports.drawerProps = Object.assign(Object.assign({}, _mixins_1.useTheme.props),
|
|
|
57
57
|
}, blockScroll: {
|
|
58
58
|
type: Boolean,
|
|
59
59
|
default: true
|
|
60
|
-
}, maxWidth: Number, maxHeight: Number, minWidth: Number, minHeight: Number, resizable: Boolean, fullscreen: Boolean,
|
|
60
|
+
}, maxWidth: Number, maxHeight: Number, minWidth: Number, minHeight: Number, resizable: Boolean, fullscreen: Boolean, defaultWidth: {
|
|
61
|
+
type: [Number, String]
|
|
62
|
+
}, defaultHeight: {
|
|
63
|
+
type: [Number, String]
|
|
64
|
+
}, onUpdateWidth: [Function, Array], onUpdateHeight: [Function, Array], 'onUpdate:width': [Function, Array], 'onUpdate:height': [Function, Array], 'onUpdate:show': [Function, Array], onUpdateShow: [Function, Array], onAfterEnter: Function, onAfterLeave: Function,
|
|
61
65
|
/** @deprecated */
|
|
62
66
|
drawerStyle: [String, Object],
|
|
63
67
|
/** @deprecated */
|
|
@@ -95,8 +99,8 @@ exports.default = (0, vue_1.defineComponent)({
|
|
|
95
99
|
const { mergedClsPrefixRef, namespaceRef, inlineThemeDisabled } = (0, _mixins_1.useConfig)(props);
|
|
96
100
|
const isMountedRef = (0, vooks_1.useIsMounted)();
|
|
97
101
|
const themeRef = (0, _mixins_1.useTheme)('Drawer', '-drawer', index_cssr_1.default, styles_1.drawerLight, props, mergedClsPrefixRef);
|
|
98
|
-
const uncontrolledWidthRef = (0, vue_1.ref)(sizesWidth[props.size]);
|
|
99
|
-
const uncontrolledHeightRef = (0, vue_1.ref)(sizesHeight[props.size]);
|
|
102
|
+
const uncontrolledWidthRef = (0, vue_1.ref)(props.defaultWidth || sizesWidth[props.size]);
|
|
103
|
+
const uncontrolledHeightRef = (0, vue_1.ref)(props.defaultHeight || sizesHeight[props.size]);
|
|
100
104
|
const mergedWidthRef = (0, vooks_1.useMergedState)((0, vue_1.toRef)(props, 'width'), uncontrolledWidthRef);
|
|
101
105
|
const mergedHeightRef = (0, vooks_1.useMergedState)((0, vue_1.toRef)(props, 'height'), uncontrolledHeightRef);
|
|
102
106
|
const styleWidthRef = (0, vue_1.computed)(() => {
|
|
@@ -115,31 +119,29 @@ exports.default = (0, vue_1.defineComponent)({
|
|
|
115
119
|
return '';
|
|
116
120
|
return (0, _utils_1.formatLength)(mergedHeightRef.value);
|
|
117
121
|
});
|
|
118
|
-
const
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
onUpdate = props.onUpdateHeight;
|
|
123
|
-
_onUpdate = props['onUpdate:height'];
|
|
124
|
-
max = props.maxHeight;
|
|
125
|
-
min = props.minHeight;
|
|
126
|
-
_ref = uncontrolledHeightRef;
|
|
122
|
+
const doUpdateWidth = (value) => {
|
|
123
|
+
const { onUpdateWidth, 'onUpdate:width': _onUpdateWidth } = props;
|
|
124
|
+
if (onUpdateWidth) {
|
|
125
|
+
(0, _utils_1.call)(onUpdateWidth, value);
|
|
127
126
|
}
|
|
128
|
-
if (
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
127
|
+
if (_onUpdateWidth) {
|
|
128
|
+
(0, _utils_1.call)(_onUpdateWidth, value);
|
|
129
|
+
}
|
|
130
|
+
uncontrolledWidthRef.value = value;
|
|
131
|
+
};
|
|
132
|
+
const doUpdateHeight = (value) => {
|
|
133
|
+
const { onUpdateHeight, 'onUpdate:width': _onUpdateHeight } = props;
|
|
134
|
+
if (onUpdateHeight) {
|
|
135
|
+
(0, _utils_1.call)(onUpdateHeight, value);
|
|
136
|
+
}
|
|
137
|
+
if (_onUpdateHeight) {
|
|
138
|
+
(0, _utils_1.call)(_onUpdateHeight, value);
|
|
139
|
+
}
|
|
140
|
+
uncontrolledHeightRef.value = value;
|
|
137
141
|
};
|
|
138
|
-
const doUpdateWidth = doUpdate.bind(null, false);
|
|
139
|
-
const doUpdateHeight = doUpdate.bind(null, true);
|
|
140
142
|
(0, vue_1.watchEffect)(() => {
|
|
141
|
-
doUpdateWidth(sizesWidth[props.size]);
|
|
142
|
-
doUpdateHeight(sizesHeight[props.size]);
|
|
143
|
+
doUpdateWidth(Number(props.defaultWidth || sizesWidth[props.size]));
|
|
144
|
+
doUpdateHeight(Number(props.defaultHeight || sizesHeight[props.size]));
|
|
143
145
|
});
|
|
144
146
|
const mergedBodyStyleRef = (0, vue_1.computed)(() => {
|
|
145
147
|
return [
|
|
@@ -268,7 +270,7 @@ exports.default = (0, vue_1.defineComponent)({
|
|
|
268
270
|
`${mergedClsPrefix}-drawer-mask--invisible`
|
|
269
271
|
], onClick: this.handleMaskClick })) : null
|
|
270
272
|
})) : null,
|
|
271
|
-
(0, vue_1.h)(DrawerBodyWrapper_1.default, Object.assign({}, this.$attrs, { class: [this.drawerClass, this.$attrs.class], style: [this.mergedBodyStyle, this.$attrs.style], blockScroll: this.blockScroll, contentStyle: this.contentStyle, placement: this.placement, rounded: this.rounded, scrollbarProps: this.scrollbarProps, show: this.show, displayDirective: this.displayDirective, nativeScrollbar: this.nativeScrollbar, onAfterEnter: this.onAfterEnter, onAfterLeave: this.onAfterLeave, trapFocus: this.trapFocus, autoFocus: this.autoFocus, resizable: this.resizable, showMask: this.showMask, onEsc: this.handleEsc, onClickoutside: this.handleMaskClick }), this.$slots)), [[vdirs_1.zindexable, { zIndex: this.zIndex, enabled: this.show }]]);
|
|
273
|
+
(0, vue_1.h)(DrawerBodyWrapper_1.default, Object.assign({}, this.$attrs, { class: [this.drawerClass, this.$attrs.class], style: [this.mergedBodyStyle, this.$attrs.style], blockScroll: this.blockScroll, contentStyle: this.contentStyle, placement: this.placement, rounded: this.rounded, scrollbarProps: this.scrollbarProps, show: this.show, displayDirective: this.displayDirective, nativeScrollbar: this.nativeScrollbar, onAfterEnter: this.onAfterEnter, onAfterLeave: this.onAfterLeave, trapFocus: this.trapFocus, autoFocus: this.autoFocus, resizable: this.resizable, maxHeight: this.maxHeight, minHeight: this.minHeight, maxWidth: this.maxWidth, minWidth: this.minWidth, showMask: this.showMask, onEsc: this.handleEsc, onClickoutside: this.handleMaskClick }), this.$slots)), [[vdirs_1.zindexable, { zIndex: this.zIndex, enabled: this.show }]]);
|
|
272
274
|
}
|
|
273
275
|
}));
|
|
274
276
|
}
|
|
@@ -37,6 +37,10 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
37
37
|
type: PropType<boolean | "transparent">;
|
|
38
38
|
required: true;
|
|
39
39
|
};
|
|
40
|
+
maxWidth: NumberConstructor;
|
|
41
|
+
maxHeight: NumberConstructor;
|
|
42
|
+
minWidth: NumberConstructor;
|
|
43
|
+
minHeight: NumberConstructor;
|
|
40
44
|
resizable: BooleanConstructor;
|
|
41
45
|
onClickoutside: PropType<(e: MouseEvent) => void>;
|
|
42
46
|
onAfterLeave: PropType<() => void>;
|
|
@@ -148,6 +152,10 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
148
152
|
type: PropType<boolean | "transparent">;
|
|
149
153
|
required: true;
|
|
150
154
|
};
|
|
155
|
+
maxWidth: NumberConstructor;
|
|
156
|
+
maxHeight: NumberConstructor;
|
|
157
|
+
minWidth: NumberConstructor;
|
|
158
|
+
minHeight: NumberConstructor;
|
|
151
159
|
resizable: BooleanConstructor;
|
|
152
160
|
onClickoutside: PropType<(e: MouseEvent) => void>;
|
|
153
161
|
onAfterLeave: PropType<() => void>;
|
|
@@ -48,6 +48,10 @@ exports.default = (0, vue_1.defineComponent)({
|
|
|
48
48
|
type: [Boolean, String],
|
|
49
49
|
required: true
|
|
50
50
|
},
|
|
51
|
+
maxWidth: Number,
|
|
52
|
+
maxHeight: Number,
|
|
53
|
+
minWidth: Number,
|
|
54
|
+
minHeight: Number,
|
|
51
55
|
resizable: Boolean,
|
|
52
56
|
onClickoutside: Function,
|
|
53
57
|
onAfterLeave: Function,
|
|
@@ -74,9 +78,9 @@ exports.default = (0, vue_1.defineComponent)({
|
|
|
74
78
|
startPosition = isVertical.value ? e.clientY : e.clientX;
|
|
75
79
|
memoizedBodyStyleCursor = document.body.style.cursor;
|
|
76
80
|
document.body.style.cursor = isVertical.value ? 'ns-resize' : 'ew-resize';
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
81
|
+
document.body.addEventListener('mousemove', handleBodyMousemove);
|
|
82
|
+
document.body.addEventListener('mouseleave', handleBodyMouseleave);
|
|
83
|
+
document.body.addEventListener('mouseup', handleBodyMouseup);
|
|
80
84
|
};
|
|
81
85
|
const handleMouseenterResizeTrigger = () => {
|
|
82
86
|
if (hoverTimerId !== null) {
|
|
@@ -100,13 +104,36 @@ exports.default = (0, vue_1.defineComponent)({
|
|
|
100
104
|
isHoverOnResizeTriggerRef.value = false;
|
|
101
105
|
};
|
|
102
106
|
const { doUpdateHeight, doUpdateWidth } = UDrawer;
|
|
103
|
-
const
|
|
107
|
+
const regulateWidth = (size) => {
|
|
108
|
+
const { maxWidth } = props;
|
|
109
|
+
if (maxWidth && size > maxWidth) {
|
|
110
|
+
return maxWidth;
|
|
111
|
+
}
|
|
112
|
+
const { minWidth } = props;
|
|
113
|
+
if (minWidth && size < minWidth) {
|
|
114
|
+
return minWidth;
|
|
115
|
+
}
|
|
116
|
+
return size;
|
|
117
|
+
};
|
|
118
|
+
const regulateHeight = (size) => {
|
|
119
|
+
const { maxHeight } = props;
|
|
120
|
+
if (maxHeight && size > maxHeight) {
|
|
121
|
+
return maxHeight;
|
|
122
|
+
}
|
|
123
|
+
const { minHeight } = props;
|
|
124
|
+
if (minHeight && size < minHeight) {
|
|
125
|
+
return minHeight;
|
|
126
|
+
}
|
|
127
|
+
return size;
|
|
128
|
+
};
|
|
129
|
+
function handleBodyMousemove(e) {
|
|
104
130
|
var _a, _b;
|
|
105
131
|
if (isDraggingRef.value) {
|
|
106
132
|
if (isVertical.value) {
|
|
107
133
|
let height = ((_a = bodyRef.value) === null || _a === void 0 ? void 0 : _a.offsetHeight) || 0;
|
|
108
134
|
const increment = startPosition - e.clientY;
|
|
109
135
|
height += props.placement === 'bottom' ? increment : -increment;
|
|
136
|
+
height = regulateHeight(height);
|
|
110
137
|
doUpdateHeight(height);
|
|
111
138
|
startPosition = e.clientY;
|
|
112
139
|
}
|
|
@@ -114,19 +141,20 @@ exports.default = (0, vue_1.defineComponent)({
|
|
|
114
141
|
let width = ((_b = bodyRef.value) === null || _b === void 0 ? void 0 : _b.offsetWidth) || 0;
|
|
115
142
|
const increment = startPosition - e.clientX;
|
|
116
143
|
width += props.placement === 'right' ? increment : -increment;
|
|
144
|
+
width = regulateWidth(width);
|
|
117
145
|
doUpdateWidth(width);
|
|
118
146
|
startPosition = e.clientX;
|
|
119
147
|
}
|
|
120
148
|
}
|
|
121
|
-
}
|
|
149
|
+
}
|
|
122
150
|
const handleBodyMouseup = () => {
|
|
123
151
|
if (isDraggingRef.value) {
|
|
124
152
|
startPosition = 0;
|
|
125
153
|
isDraggingRef.value = false;
|
|
126
154
|
document.body.style.cursor = memoizedBodyStyleCursor;
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
155
|
+
document.body.removeEventListener('mousemove', handleBodyMousemove);
|
|
156
|
+
document.body.removeEventListener('mouseup', handleBodyMouseup);
|
|
157
|
+
document.body.removeEventListener('mouseleave', handleBodyMouseleave);
|
|
130
158
|
}
|
|
131
159
|
};
|
|
132
160
|
const handleBodyMouseleave = handleBodyMouseup;
|
|
@@ -6,7 +6,12 @@ export declare const infiniteScrollProps: {
|
|
|
6
6
|
readonly type: NumberConstructor;
|
|
7
7
|
readonly default: 0;
|
|
8
8
|
};
|
|
9
|
+
readonly topDistance: {
|
|
10
|
+
readonly type: NumberConstructor;
|
|
11
|
+
readonly default: 0;
|
|
12
|
+
};
|
|
9
13
|
readonly onLoad: PropType<() => Promise<void> | void>;
|
|
14
|
+
readonly onLoadTop: PropType<() => Promise<void> | void>;
|
|
10
15
|
readonly scrollbarProps: PropType<ScrollbarProps>;
|
|
11
16
|
};
|
|
12
17
|
export type InfiniteScrollProps = ExtractPublicPropTypes<typeof infiniteScrollProps>;
|
|
@@ -15,7 +20,12 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
15
20
|
readonly type: NumberConstructor;
|
|
16
21
|
readonly default: 0;
|
|
17
22
|
};
|
|
23
|
+
readonly topDistance: {
|
|
24
|
+
readonly type: NumberConstructor;
|
|
25
|
+
readonly default: 0;
|
|
26
|
+
};
|
|
18
27
|
readonly onLoad: PropType<() => Promise<void> | void>;
|
|
28
|
+
readonly onLoadTop: PropType<() => Promise<void> | void>;
|
|
19
29
|
readonly scrollbarProps: PropType<ScrollbarProps>;
|
|
20
30
|
}, {
|
|
21
31
|
scrollbarInstRef: import("vue").Ref<{
|
|
@@ -37,9 +47,15 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
37
47
|
readonly type: NumberConstructor;
|
|
38
48
|
readonly default: 0;
|
|
39
49
|
};
|
|
50
|
+
readonly topDistance: {
|
|
51
|
+
readonly type: NumberConstructor;
|
|
52
|
+
readonly default: 0;
|
|
53
|
+
};
|
|
40
54
|
readonly onLoad: PropType<() => Promise<void> | void>;
|
|
55
|
+
readonly onLoadTop: PropType<() => Promise<void> | void>;
|
|
41
56
|
readonly scrollbarProps: PropType<ScrollbarProps>;
|
|
42
57
|
}>>, {
|
|
43
58
|
readonly distance: number;
|
|
59
|
+
readonly topDistance: number;
|
|
44
60
|
}, {}>;
|
|
45
61
|
export default _default;
|
|
@@ -18,7 +18,12 @@ exports.infiniteScrollProps = {
|
|
|
18
18
|
type: Number,
|
|
19
19
|
default: 0
|
|
20
20
|
},
|
|
21
|
+
topDistance: {
|
|
22
|
+
type: Number,
|
|
23
|
+
default: 0
|
|
24
|
+
},
|
|
21
25
|
onLoad: Function,
|
|
26
|
+
onLoadTop: Function,
|
|
22
27
|
scrollbarProps: Object
|
|
23
28
|
};
|
|
24
29
|
exports.default = (0, vue_1.defineComponent)({
|
|
@@ -26,7 +31,8 @@ exports.default = (0, vue_1.defineComponent)({
|
|
|
26
31
|
props: exports.infiniteScrollProps,
|
|
27
32
|
setup(props) {
|
|
28
33
|
const scrollbarInstRef = (0, vue_1.ref)(null);
|
|
29
|
-
let
|
|
34
|
+
let loadingBottom = false;
|
|
35
|
+
let loadingTop = false;
|
|
30
36
|
const handleCheckBottom = () => __awaiter(this, void 0, void 0, function* () {
|
|
31
37
|
var _a;
|
|
32
38
|
const { value: scrollbarInst } = scrollbarInstRef;
|
|
@@ -40,27 +46,57 @@ exports.default = (0, vue_1.defineComponent)({
|
|
|
40
46
|
clientHeight !== undefined &&
|
|
41
47
|
scrollTop !== undefined) {
|
|
42
48
|
if (scrollTop + clientHeight >= scrollHeight - props.distance) {
|
|
43
|
-
|
|
49
|
+
loadingBottom = true;
|
|
44
50
|
try {
|
|
45
51
|
yield ((_a = props.onLoad) === null || _a === void 0 ? void 0 : _a.call(props));
|
|
46
52
|
}
|
|
47
53
|
catch (_b) { }
|
|
48
|
-
|
|
54
|
+
loadingBottom = false;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
});
|
|
59
|
+
const handleCheckTop = () => __awaiter(this, void 0, void 0, function* () {
|
|
60
|
+
var _a;
|
|
61
|
+
const { value: scrollbarInst } = scrollbarInstRef;
|
|
62
|
+
if (scrollbarInst) {
|
|
63
|
+
const { containerRef } = scrollbarInst;
|
|
64
|
+
const scrollTop = containerRef === null || containerRef === void 0 ? void 0 : containerRef.scrollTop;
|
|
65
|
+
if (containerRef && scrollTop !== undefined) {
|
|
66
|
+
if (scrollTop <= props.topDistance) {
|
|
67
|
+
loadingTop = true;
|
|
68
|
+
const oldScrollHeight = containerRef.scrollHeight;
|
|
69
|
+
const oldScrollTop = containerRef.scrollTop;
|
|
70
|
+
try {
|
|
71
|
+
yield ((_a = props.onLoadTop) === null || _a === void 0 ? void 0 : _a.call(props));
|
|
72
|
+
yield (0, vue_1.nextTick)();
|
|
73
|
+
const newScrollHeight = containerRef.scrollHeight;
|
|
74
|
+
const heightDiff = newScrollHeight - oldScrollHeight;
|
|
75
|
+
if (heightDiff > 0) {
|
|
76
|
+
containerRef.scrollTop = oldScrollTop + heightDiff;
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
catch (_b) { }
|
|
80
|
+
loadingTop = false;
|
|
49
81
|
}
|
|
50
82
|
}
|
|
51
83
|
}
|
|
52
84
|
});
|
|
53
85
|
const handleScroll = () => {
|
|
54
|
-
if (
|
|
55
|
-
|
|
56
|
-
|
|
86
|
+
if (!loadingBottom) {
|
|
87
|
+
void handleCheckBottom();
|
|
88
|
+
}
|
|
89
|
+
if (!loadingTop) {
|
|
90
|
+
void handleCheckTop();
|
|
91
|
+
}
|
|
57
92
|
};
|
|
58
93
|
const handleWheel = (e) => {
|
|
59
|
-
if (e.deltaY
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
94
|
+
if (e.deltaY > 0 && !loadingBottom) {
|
|
95
|
+
void handleCheckBottom();
|
|
96
|
+
}
|
|
97
|
+
if (e.deltaY < 0 && !loadingTop) {
|
|
98
|
+
void handleCheckTop();
|
|
99
|
+
}
|
|
64
100
|
};
|
|
65
101
|
return {
|
|
66
102
|
scrollbarInstRef,
|
|
@@ -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.safeTopScrollbarProps = exports.USafeTopScrollbar = void 0;
|
|
7
|
+
var SafeTopScrollbar_1 = require("./src/SafeTopScrollbar");
|
|
8
|
+
Object.defineProperty(exports, "USafeTopScrollbar", { enumerable: true, get: function () { return __importDefault(SafeTopScrollbar_1).default; } });
|
|
9
|
+
Object.defineProperty(exports, "safeTopScrollbarProps", { enumerable: true, get: function () { return SafeTopScrollbar_1.safeTopScrollbarProps; } });
|
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
import { type PropType } from 'vue';
|
|
2
|
+
import type { ExtractPublicPropTypes } from '../../_utils';
|
|
3
|
+
export interface ScrollTo {
|
|
4
|
+
(x: number, y: number): void;
|
|
5
|
+
(options: {
|
|
6
|
+
left?: number;
|
|
7
|
+
top?: number;
|
|
8
|
+
behavior?: ScrollBehavior;
|
|
9
|
+
}): void;
|
|
10
|
+
}
|
|
11
|
+
export type ScrollBy = ScrollTo;
|
|
12
|
+
export interface SafeTopScrollbarInst {
|
|
13
|
+
scrollTo: ScrollTo;
|
|
14
|
+
scrollBy: ScrollBy;
|
|
15
|
+
getScrollState: () => {
|
|
16
|
+
scrollHeight: number;
|
|
17
|
+
scrollTop: number;
|
|
18
|
+
clientHeight: number;
|
|
19
|
+
};
|
|
20
|
+
adjustScrollTop: (heightDiff: number) => void;
|
|
21
|
+
}
|
|
22
|
+
export declare const safeTopScrollbarProps: {
|
|
23
|
+
readonly trigger: PropType<"none" | "hover">;
|
|
24
|
+
readonly xScrollable: BooleanConstructor;
|
|
25
|
+
readonly onScroll: PropType<(e: Event) => void>;
|
|
26
|
+
readonly size: NumberConstructor;
|
|
27
|
+
readonly theme: PropType<import("../../_mixins").Theme<"SafeTopScrollbar", {
|
|
28
|
+
height: string;
|
|
29
|
+
width: string;
|
|
30
|
+
borderRadius: string;
|
|
31
|
+
color: string;
|
|
32
|
+
colorHover: string;
|
|
33
|
+
railInsetHorizontalBottom: string;
|
|
34
|
+
railInsetHorizontalTop: string;
|
|
35
|
+
railInsetVerticalRight: string;
|
|
36
|
+
railInsetVerticalLeft: string;
|
|
37
|
+
railColor: string;
|
|
38
|
+
}, any>>;
|
|
39
|
+
readonly themeOverrides: PropType<import("../../_mixins/use-theme").ExtractThemeOverrides<import("../../_mixins").Theme<"SafeTopScrollbar", {
|
|
40
|
+
height: string;
|
|
41
|
+
width: string;
|
|
42
|
+
borderRadius: string;
|
|
43
|
+
color: string;
|
|
44
|
+
colorHover: string;
|
|
45
|
+
railInsetHorizontalBottom: string;
|
|
46
|
+
railInsetHorizontalTop: string;
|
|
47
|
+
railInsetVerticalRight: string;
|
|
48
|
+
railInsetVerticalLeft: string;
|
|
49
|
+
railColor: string;
|
|
50
|
+
}, any>>>;
|
|
51
|
+
readonly builtinThemeOverrides: PropType<import("../../_mixins/use-theme").ExtractThemeOverrides<import("../../_mixins").Theme<"SafeTopScrollbar", {
|
|
52
|
+
height: string;
|
|
53
|
+
width: string;
|
|
54
|
+
borderRadius: string;
|
|
55
|
+
color: string;
|
|
56
|
+
colorHover: string;
|
|
57
|
+
railInsetHorizontalBottom: string;
|
|
58
|
+
railInsetHorizontalTop: string;
|
|
59
|
+
railInsetVerticalRight: string;
|
|
60
|
+
railInsetVerticalLeft: string;
|
|
61
|
+
railColor: string;
|
|
62
|
+
}, any>>>;
|
|
63
|
+
};
|
|
64
|
+
export type SafeTopScrollbarProps = ExtractPublicPropTypes<typeof safeTopScrollbarProps>;
|
|
65
|
+
declare const SafeTopScrollbar: import("vue").DefineComponent<{
|
|
66
|
+
readonly trigger: PropType<"none" | "hover">;
|
|
67
|
+
readonly xScrollable: BooleanConstructor;
|
|
68
|
+
readonly onScroll: PropType<(e: Event) => void>;
|
|
69
|
+
readonly size: NumberConstructor;
|
|
70
|
+
readonly theme: PropType<import("../../_mixins").Theme<"SafeTopScrollbar", {
|
|
71
|
+
height: string;
|
|
72
|
+
width: string;
|
|
73
|
+
borderRadius: string;
|
|
74
|
+
color: string;
|
|
75
|
+
colorHover: string;
|
|
76
|
+
railInsetHorizontalBottom: string;
|
|
77
|
+
railInsetHorizontalTop: string;
|
|
78
|
+
railInsetVerticalRight: string;
|
|
79
|
+
railInsetVerticalLeft: string;
|
|
80
|
+
railColor: string;
|
|
81
|
+
}, any>>;
|
|
82
|
+
readonly themeOverrides: PropType<import("../../_mixins/use-theme").ExtractThemeOverrides<import("../../_mixins").Theme<"SafeTopScrollbar", {
|
|
83
|
+
height: string;
|
|
84
|
+
width: string;
|
|
85
|
+
borderRadius: string;
|
|
86
|
+
color: string;
|
|
87
|
+
colorHover: string;
|
|
88
|
+
railInsetHorizontalBottom: string;
|
|
89
|
+
railInsetHorizontalTop: string;
|
|
90
|
+
railInsetVerticalRight: string;
|
|
91
|
+
railInsetVerticalLeft: string;
|
|
92
|
+
railColor: string;
|
|
93
|
+
}, any>>>;
|
|
94
|
+
readonly builtinThemeOverrides: PropType<import("../../_mixins/use-theme").ExtractThemeOverrides<import("../../_mixins").Theme<"SafeTopScrollbar", {
|
|
95
|
+
height: string;
|
|
96
|
+
width: string;
|
|
97
|
+
borderRadius: string;
|
|
98
|
+
color: string;
|
|
99
|
+
colorHover: string;
|
|
100
|
+
railInsetHorizontalBottom: string;
|
|
101
|
+
railInsetHorizontalTop: string;
|
|
102
|
+
railInsetVerticalRight: string;
|
|
103
|
+
railInsetVerticalLeft: string;
|
|
104
|
+
railColor: string;
|
|
105
|
+
}, any>>>;
|
|
106
|
+
}, {
|
|
107
|
+
scrollbarInstRef: import("vue").Ref<{
|
|
108
|
+
$el: HTMLElement;
|
|
109
|
+
containerRef: HTMLElement | null;
|
|
110
|
+
contentRef: HTMLElement | null;
|
|
111
|
+
containerScrollTop: number;
|
|
112
|
+
syncUnifiedContainer: () => void;
|
|
113
|
+
scrollTo: import("../../_internal/safe-top-scrollbar/src/SafeTopScrollbar").ScrollTo;
|
|
114
|
+
scrollBy: import("../../_internal/safe-top-scrollbar/src/SafeTopScrollbar").ScrollBy;
|
|
115
|
+
sync: () => void;
|
|
116
|
+
handleMouseEnterWrapper: () => void;
|
|
117
|
+
handleMouseLeaveWrapper: () => void;
|
|
118
|
+
getScrollState: () => {
|
|
119
|
+
scrollHeight: number;
|
|
120
|
+
scrollTop: number;
|
|
121
|
+
clientHeight: number;
|
|
122
|
+
};
|
|
123
|
+
adjustScrollTop: (heightDiff: number) => void;
|
|
124
|
+
} | null>;
|
|
125
|
+
scrollTo: ScrollTo;
|
|
126
|
+
scrollBy: ScrollBy;
|
|
127
|
+
getScrollState: () => {
|
|
128
|
+
scrollHeight: number;
|
|
129
|
+
scrollTop: number;
|
|
130
|
+
clientHeight: number;
|
|
131
|
+
};
|
|
132
|
+
adjustScrollTop: (heightDiff: number) => void;
|
|
133
|
+
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
|
|
134
|
+
readonly trigger: PropType<"none" | "hover">;
|
|
135
|
+
readonly xScrollable: BooleanConstructor;
|
|
136
|
+
readonly onScroll: PropType<(e: Event) => void>;
|
|
137
|
+
readonly size: NumberConstructor;
|
|
138
|
+
readonly theme: PropType<import("../../_mixins").Theme<"SafeTopScrollbar", {
|
|
139
|
+
height: string;
|
|
140
|
+
width: string;
|
|
141
|
+
borderRadius: string;
|
|
142
|
+
color: string;
|
|
143
|
+
colorHover: string;
|
|
144
|
+
railInsetHorizontalBottom: string;
|
|
145
|
+
railInsetHorizontalTop: string;
|
|
146
|
+
railInsetVerticalRight: string;
|
|
147
|
+
railInsetVerticalLeft: string;
|
|
148
|
+
railColor: string;
|
|
149
|
+
}, any>>;
|
|
150
|
+
readonly themeOverrides: PropType<import("../../_mixins/use-theme").ExtractThemeOverrides<import("../../_mixins").Theme<"SafeTopScrollbar", {
|
|
151
|
+
height: string;
|
|
152
|
+
width: string;
|
|
153
|
+
borderRadius: string;
|
|
154
|
+
color: string;
|
|
155
|
+
colorHover: string;
|
|
156
|
+
railInsetHorizontalBottom: string;
|
|
157
|
+
railInsetHorizontalTop: string;
|
|
158
|
+
railInsetVerticalRight: string;
|
|
159
|
+
railInsetVerticalLeft: string;
|
|
160
|
+
railColor: string;
|
|
161
|
+
}, any>>>;
|
|
162
|
+
readonly builtinThemeOverrides: PropType<import("../../_mixins/use-theme").ExtractThemeOverrides<import("../../_mixins").Theme<"SafeTopScrollbar", {
|
|
163
|
+
height: string;
|
|
164
|
+
width: string;
|
|
165
|
+
borderRadius: string;
|
|
166
|
+
color: string;
|
|
167
|
+
colorHover: string;
|
|
168
|
+
railInsetHorizontalBottom: string;
|
|
169
|
+
railInsetHorizontalTop: string;
|
|
170
|
+
railInsetVerticalRight: string;
|
|
171
|
+
railInsetVerticalLeft: string;
|
|
172
|
+
railColor: string;
|
|
173
|
+
}, any>>>;
|
|
174
|
+
}>>, {
|
|
175
|
+
readonly xScrollable: boolean;
|
|
176
|
+
}, {}>;
|
|
177
|
+
export default SafeTopScrollbar;
|