stream-chat-react-native-core 3.8.3-next.1 → 3.9.0-next.2
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/lib/commonjs/components/Attachment/Gallery.js +21 -9
- package/lib/commonjs/components/Attachment/Gallery.js.map +1 -1
- package/lib/commonjs/components/Channel/Channel.js +52 -30
- package/lib/commonjs/components/Channel/Channel.js.map +1 -1
- package/lib/commonjs/components/Channel/hooks/useCreateChannelContext.js +4 -0
- package/lib/commonjs/components/Channel/hooks/useCreateChannelContext.js.map +1 -1
- package/lib/commonjs/components/Channel/hooks/useCreateMessagesContext.js +4 -0
- package/lib/commonjs/components/Channel/hooks/useCreateMessagesContext.js.map +1 -1
- package/lib/commonjs/components/Message/MessageSimple/MessageSimple.js +9 -6
- package/lib/commonjs/components/Message/MessageSimple/MessageSimple.js.map +1 -1
- package/lib/commonjs/components/MessageInput/FileUploadPreview.js +28 -23
- package/lib/commonjs/components/MessageInput/FileUploadPreview.js.map +1 -1
- package/lib/commonjs/components/MessageList/MessageList.js +40 -31
- package/lib/commonjs/components/MessageList/MessageList.js.map +1 -1
- package/lib/commonjs/components/MessageList/hooks/useMessageList.js +1 -1
- package/lib/commonjs/components/MessageList/hooks/useMessageList.js.map +1 -1
- package/lib/commonjs/components/MessageList/utils/getGroupStyles.js +1 -5
- package/lib/commonjs/components/MessageList/utils/getGroupStyles.js.map +1 -1
- package/lib/commonjs/contexts/channelContext/ChannelContext.js +2 -2
- package/lib/commonjs/contexts/channelContext/ChannelContext.js.map +1 -1
- package/lib/commonjs/contexts/messagesContext/MessagesContext.js +2 -2
- package/lib/commonjs/contexts/messagesContext/MessagesContext.js.map +1 -1
- package/lib/commonjs/version.json +1 -1
- package/lib/module/components/Attachment/Gallery.js +21 -9
- package/lib/module/components/Attachment/Gallery.js.map +1 -1
- package/lib/module/components/Channel/Channel.js +52 -30
- package/lib/module/components/Channel/Channel.js.map +1 -1
- package/lib/module/components/Channel/hooks/useCreateChannelContext.js +4 -0
- package/lib/module/components/Channel/hooks/useCreateChannelContext.js.map +1 -1
- package/lib/module/components/Channel/hooks/useCreateMessagesContext.js +4 -0
- package/lib/module/components/Channel/hooks/useCreateMessagesContext.js.map +1 -1
- package/lib/module/components/Message/MessageSimple/MessageSimple.js +9 -6
- package/lib/module/components/Message/MessageSimple/MessageSimple.js.map +1 -1
- package/lib/module/components/MessageInput/FileUploadPreview.js +28 -23
- package/lib/module/components/MessageInput/FileUploadPreview.js.map +1 -1
- package/lib/module/components/MessageList/MessageList.js +40 -31
- package/lib/module/components/MessageList/MessageList.js.map +1 -1
- package/lib/module/components/MessageList/hooks/useMessageList.js +1 -1
- package/lib/module/components/MessageList/hooks/useMessageList.js.map +1 -1
- package/lib/module/components/MessageList/utils/getGroupStyles.js +1 -5
- package/lib/module/components/MessageList/utils/getGroupStyles.js.map +1 -1
- package/lib/module/contexts/channelContext/ChannelContext.js +2 -2
- package/lib/module/contexts/channelContext/ChannelContext.js.map +1 -1
- package/lib/module/contexts/messagesContext/MessagesContext.js +2 -2
- package/lib/module/contexts/messagesContext/MessagesContext.js.map +1 -1
- package/lib/module/version.json +1 -1
- package/lib/typescript/components/Attachment/Gallery.d.ts +1 -1
- package/lib/typescript/components/Channel/Channel.d.ts +3 -1
- package/lib/typescript/components/Channel/hooks/useCreateChannelContext.d.ts +1 -1
- package/lib/typescript/components/Channel/hooks/useCreateMessagesContext.d.ts +4 -2
- package/lib/typescript/components/Message/MessageSimple/MessageSimple.d.ts +1 -1
- package/lib/typescript/components/MessageList/MessageList.d.ts +1 -1
- package/lib/typescript/contexts/channelContext/ChannelContext.d.ts +3 -1
- package/lib/typescript/contexts/messagesContext/MessagesContext.d.ts +3 -1
- package/package.json +1 -1
- package/src/components/Attachment/Gallery.tsx +20 -5
- package/src/components/Channel/Channel.tsx +124 -67
- package/src/components/Channel/hooks/useCreateChannelContext.ts +4 -0
- package/src/components/Channel/hooks/useCreateMessagesContext.ts +4 -0
- package/src/components/Message/MessageSimple/MessageSimple.tsx +9 -3
- package/src/components/MessageInput/FileUploadPreview.tsx +68 -58
- package/src/components/MessageInput/__tests__/__snapshots__/FileUploadPreview.test.js.snap +778 -730
- package/src/components/MessageList/MessageList.tsx +52 -27
- package/src/components/MessageList/hooks/useMessageList.ts +1 -1
- package/src/components/MessageList/utils/getGroupStyles.ts +3 -8
- package/src/contexts/channelContext/ChannelContext.tsx +2 -0
- package/src/contexts/messagesContext/MessagesContext.tsx +2 -0
- package/src/version.json +1 -1
- package/lib/commonjs/components/Channel/utils/debounce.js +0 -20
- package/lib/commonjs/components/Channel/utils/debounce.js.map +0 -1
- package/lib/commonjs/components/Channel/utils/throttle.js +0 -20
- package/lib/commonjs/components/Channel/utils/throttle.js.map +0 -1
- package/lib/module/components/Channel/utils/debounce.js +0 -20
- package/lib/module/components/Channel/utils/debounce.js.map +0 -1
- package/lib/module/components/Channel/utils/throttle.js +0 -20
- package/lib/module/components/Channel/utils/throttle.js.map +0 -1
- package/lib/typescript/components/Channel/utils/debounce.d.ts +0 -2
- package/lib/typescript/components/Channel/utils/throttle.d.ts +0 -2
- package/src/components/Channel/utils/debounce.ts +0 -12
- package/src/components/Channel/utils/throttle.ts +0 -12
|
@@ -131,6 +131,7 @@ type MessageListPropsWithContext<
|
|
|
131
131
|
| 'channel'
|
|
132
132
|
| 'disabled'
|
|
133
133
|
| 'EmptyStateIndicator'
|
|
134
|
+
| 'hideStickyDateHeader'
|
|
134
135
|
| 'loadChannelAtMessage'
|
|
135
136
|
| 'loading'
|
|
136
137
|
| 'LoadingIndicator'
|
|
@@ -158,6 +159,7 @@ type MessageListPropsWithContext<
|
|
|
158
159
|
| 'initialScrollToFirstUnreadMessage'
|
|
159
160
|
| 'InlineDateSeparator'
|
|
160
161
|
| 'InlineUnreadIndicator'
|
|
162
|
+
| 'legacyImageViewerSwipeBehaviour'
|
|
161
163
|
| 'Message'
|
|
162
164
|
| 'ScrollToBottomButton'
|
|
163
165
|
| 'MessageSystem'
|
|
@@ -264,10 +266,12 @@ const MessageListWithContext = <
|
|
|
264
266
|
FlatList,
|
|
265
267
|
FooterComponent = LoadingMoreIndicator,
|
|
266
268
|
HeaderComponent = InlineLoadingMoreRecentIndicator,
|
|
269
|
+
hideStickyDateHeader,
|
|
267
270
|
initialScrollToFirstUnreadMessage,
|
|
268
271
|
InlineDateSeparator,
|
|
269
272
|
InlineUnreadIndicator,
|
|
270
273
|
inverted = true,
|
|
274
|
+
legacyImageViewerSwipeBehaviour,
|
|
271
275
|
loadChannelAtMessage,
|
|
272
276
|
loading,
|
|
273
277
|
LoadingIndicator,
|
|
@@ -410,7 +414,7 @@ const MessageListWithContext = <
|
|
|
410
414
|
*/
|
|
411
415
|
const onViewableItemsChanged = useRef(
|
|
412
416
|
({ viewableItems }: { viewableItems: ViewToken[] | undefined }) => {
|
|
413
|
-
if (viewableItems) {
|
|
417
|
+
if (viewableItems && !hideStickyDateHeader) {
|
|
414
418
|
updateStickyHeaderDateIfNeeded(viewableItems);
|
|
415
419
|
}
|
|
416
420
|
setInitialScrollIfNeeded();
|
|
@@ -785,44 +789,58 @@ const MessageListWithContext = <
|
|
|
785
789
|
[messageListLengthAfterUpdate],
|
|
786
790
|
);
|
|
787
791
|
|
|
788
|
-
const messagesWithImages =
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
792
|
+
const messagesWithImages =
|
|
793
|
+
legacyImageViewerSwipeBehaviour &&
|
|
794
|
+
messageList.filter((message) => {
|
|
795
|
+
if (!message.deleted_at && message.attachments) {
|
|
796
|
+
return message.attachments.some(
|
|
797
|
+
(attachment) =>
|
|
798
|
+
attachment.type === 'image' &&
|
|
799
|
+
!attachment.title_link &&
|
|
800
|
+
!attachment.og_scrape_url &&
|
|
801
|
+
(attachment.image_url || attachment.thumb_url),
|
|
802
|
+
);
|
|
803
|
+
}
|
|
804
|
+
return false;
|
|
805
|
+
});
|
|
800
806
|
|
|
801
807
|
/**
|
|
802
808
|
* This is for the useEffect to run again in the case that a message
|
|
803
809
|
* gets edited with more or the same number of images
|
|
804
810
|
*/
|
|
805
|
-
const imageString =
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
811
|
+
const imageString =
|
|
812
|
+
legacyImageViewerSwipeBehaviour &&
|
|
813
|
+
messagesWithImages &&
|
|
814
|
+
messagesWithImages
|
|
815
|
+
.map((message) =>
|
|
816
|
+
message.attachments
|
|
817
|
+
?.map((attachment) => attachment.image_url || attachment.thumb_url || '')
|
|
818
|
+
.join(),
|
|
819
|
+
)
|
|
820
|
+
.join();
|
|
821
|
+
|
|
822
|
+
const numberOfMessagesWithImages =
|
|
823
|
+
legacyImageViewerSwipeBehaviour && messagesWithImages && messagesWithImages.length;
|
|
814
824
|
const threadExists = !!thread;
|
|
825
|
+
|
|
815
826
|
useEffect(() => {
|
|
816
|
-
if ((threadList && thread) || (!threadList && !thread)) {
|
|
817
|
-
setImages(messagesWithImages);
|
|
827
|
+
if (legacyImageViewerSwipeBehaviour && ((threadList && thread) || (!threadList && !thread))) {
|
|
828
|
+
setImages(messagesWithImages as MessageType<At, Ch, Co, Ev, Me, Re, Us>[]);
|
|
818
829
|
}
|
|
819
|
-
}, [
|
|
830
|
+
}, [
|
|
831
|
+
imageString,
|
|
832
|
+
legacyImageViewerSwipeBehaviour,
|
|
833
|
+
numberOfMessagesWithImages,
|
|
834
|
+
threadExists,
|
|
835
|
+
threadList,
|
|
836
|
+
]);
|
|
820
837
|
|
|
821
838
|
const stickyHeaderFormatDate =
|
|
822
839
|
stickyHeaderDate?.getFullYear() === new Date().getFullYear() ? 'MMM D' : 'MMM D, YYYY';
|
|
823
|
-
const tStickyHeaderDate =
|
|
840
|
+
const tStickyHeaderDate =
|
|
841
|
+
stickyHeaderDate && !hideStickyDateHeader ? tDateTimeParser(stickyHeaderDate) : null;
|
|
824
842
|
const stickyHeaderDateToRender =
|
|
825
|
-
tStickyHeaderDate === null
|
|
843
|
+
tStickyHeaderDate === null || hideStickyDateHeader
|
|
826
844
|
? null
|
|
827
845
|
: isDayOrMoment(tStickyHeaderDate)
|
|
828
846
|
? tStickyHeaderDate.format(stickyHeaderFormatDate)
|
|
@@ -943,7 +961,9 @@ export const MessageList = <
|
|
|
943
961
|
channel,
|
|
944
962
|
disabled,
|
|
945
963
|
EmptyStateIndicator,
|
|
964
|
+
enableMessageGroupingByUser,
|
|
946
965
|
error,
|
|
966
|
+
hideStickyDateHeader,
|
|
947
967
|
loadChannelAtMessage,
|
|
948
968
|
loading,
|
|
949
969
|
LoadingIndicator,
|
|
@@ -965,6 +985,7 @@ export const MessageList = <
|
|
|
965
985
|
initialScrollToFirstUnreadMessage,
|
|
966
986
|
InlineDateSeparator,
|
|
967
987
|
InlineUnreadIndicator,
|
|
988
|
+
legacyImageViewerSwipeBehaviour,
|
|
968
989
|
Message,
|
|
969
990
|
MessageSystem,
|
|
970
991
|
myMessageTheme,
|
|
@@ -987,11 +1008,14 @@ export const MessageList = <
|
|
|
987
1008
|
disabled,
|
|
988
1009
|
disableTypingIndicator,
|
|
989
1010
|
EmptyStateIndicator,
|
|
1011
|
+
enableMessageGroupingByUser,
|
|
990
1012
|
error,
|
|
991
1013
|
FlatList,
|
|
1014
|
+
hideStickyDateHeader,
|
|
992
1015
|
initialScrollToFirstUnreadMessage,
|
|
993
1016
|
InlineDateSeparator,
|
|
994
1017
|
InlineUnreadIndicator,
|
|
1018
|
+
legacyImageViewerSwipeBehaviour,
|
|
995
1019
|
loadChannelAtMessage,
|
|
996
1020
|
loading,
|
|
997
1021
|
LoadingIndicator,
|
|
@@ -1021,6 +1045,7 @@ export const MessageList = <
|
|
|
1021
1045
|
TypingIndicatorContainer,
|
|
1022
1046
|
}}
|
|
1023
1047
|
{...props}
|
|
1048
|
+
noGroupByUser={!enableMessageGroupingByUser || props.noGroupByUser}
|
|
1024
1049
|
/>
|
|
1025
1050
|
);
|
|
1026
1051
|
};
|
|
@@ -116,7 +116,7 @@ export const useMessageList = <
|
|
|
116
116
|
.map((msg) => ({
|
|
117
117
|
...msg,
|
|
118
118
|
dateSeparator: dateSeparators[msg.id] || undefined,
|
|
119
|
-
groupStyles: messageGroupStyles[msg.id] || [],
|
|
119
|
+
groupStyles: messageGroupStyles[msg.id] || ['single'],
|
|
120
120
|
readBy: msg.id ? readData[msg.id] || false : false,
|
|
121
121
|
}));
|
|
122
122
|
|
|
@@ -53,6 +53,9 @@ export const getGroupStyles = <
|
|
|
53
53
|
noGroupByUser,
|
|
54
54
|
userId,
|
|
55
55
|
} = params;
|
|
56
|
+
|
|
57
|
+
if (noGroupByUser) return {};
|
|
58
|
+
|
|
56
59
|
const messageGroupStyles: { [key: string]: GroupType[] } = {};
|
|
57
60
|
|
|
58
61
|
const messagesFilteredForNonUser = messages.filter(
|
|
@@ -128,14 +131,6 @@ export const getGroupStyles = <
|
|
|
128
131
|
}
|
|
129
132
|
}
|
|
130
133
|
|
|
131
|
-
/**
|
|
132
|
-
* If noGroupByUser set add the key for single
|
|
133
|
-
*/
|
|
134
|
-
if (noGroupByUser) {
|
|
135
|
-
groupStyles.splice(0, groupStyles.length);
|
|
136
|
-
groupStyles.push('single');
|
|
137
|
-
}
|
|
138
|
-
|
|
139
134
|
if (message.id) {
|
|
140
135
|
messageGroupStyles[message.id] = groupStyles;
|
|
141
136
|
}
|
|
@@ -53,6 +53,7 @@ export type ChannelContextValue<
|
|
|
53
53
|
* Hide inline date separators on channel
|
|
54
54
|
*/
|
|
55
55
|
hideDateSeparators: boolean;
|
|
56
|
+
hideStickyDateHeader: boolean;
|
|
56
57
|
/**
|
|
57
58
|
* Returns true if the current user has admin privileges
|
|
58
59
|
*/
|
|
@@ -164,6 +165,7 @@ export type ChannelContextValue<
|
|
|
164
165
|
*/
|
|
165
166
|
channel?: Channel<At, Ch, Co, Ev, Me, Re, Us>;
|
|
166
167
|
disabled?: boolean;
|
|
168
|
+
enableMessageGroupingByUser?: boolean;
|
|
167
169
|
lastRead?: Date;
|
|
168
170
|
/**
|
|
169
171
|
* Maximum time in milliseconds that should occur between messages
|
|
@@ -97,6 +97,7 @@ export type MessagesContextValue<
|
|
|
97
97
|
DateHeader: React.ComponentType<DateHeaderProps>;
|
|
98
98
|
/** Should keyboard be dismissed when messaged is touched */
|
|
99
99
|
dismissKeyboardOnMessageTouch: boolean;
|
|
100
|
+
enableMessageGroupingByUser: boolean;
|
|
100
101
|
/**
|
|
101
102
|
* UI component to display File type attachment.
|
|
102
103
|
* Defaults to: [FileAttachment](https://github.com/GetStream/stream-chat-react-native/blob/master/src/components/Attachment/FileAttachment.tsx)
|
|
@@ -326,6 +327,7 @@ export type MessagesContextValue<
|
|
|
326
327
|
handleRetry?: (message: MessageType<At, Ch, Co, Ev, Me, Re, Us>) => Promise<void>;
|
|
327
328
|
/** Handler to access when a thread reply action is invoked */
|
|
328
329
|
handleThreadReply?: (message: MessageType<At, Ch, Co, Ev, Me, Re, Us>) => Promise<void>;
|
|
330
|
+
legacyImageViewerSwipeBehaviour?: boolean;
|
|
329
331
|
/** Object specifying rules defined within simple-markdown https://github.com/Khan/simple-markdown#adding-a-simple-extension */
|
|
330
332
|
markdownRules?: MarkdownRules;
|
|
331
333
|
/**
|
package/src/version.json
CHANGED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.heavyDebounce = void 0;
|
|
7
|
-
|
|
8
|
-
var _debounce = _interopRequireDefault(require("lodash/debounce"));
|
|
9
|
-
|
|
10
|
-
var heavyDebounce = function heavyDebounce(callback) {
|
|
11
|
-
var ms = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 500;
|
|
12
|
-
var option = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {
|
|
13
|
-
leading: true,
|
|
14
|
-
trailing: true
|
|
15
|
-
};
|
|
16
|
-
return (0, _debounce["default"])(callback, ms, option);
|
|
17
|
-
};
|
|
18
|
-
|
|
19
|
-
exports.heavyDebounce = heavyDebounce;
|
|
20
|
-
//# sourceMappingURL=debounce.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["debounce.ts"],"names":["heavyDebounce","callback","ms","option","leading","trailing"],"mappings":";;;;;;;AAEA;;AAEO,IAAMA,aAAa,GAAG,SAAhBA,aAAgB,CAC3BC,QAD2B;AAAA,MAE3BC,EAF2B,uEAEtB,GAFsB;AAAA,MAG3BC,MAH2B,uEAGA;AACzBC,IAAAA,OAAO,EAAE,IADgB;AAEzBC,IAAAA,QAAQ,EAAE;AAFe,GAHA;AAAA,SAOxB,0BAASJ,QAAT,EAAmBC,EAAnB,EAAuBC,MAAvB,CAPwB;AAAA,CAAtB","sourcesContent":["/* eslint-disable @typescript-eslint/no-explicit-any */\nimport type { DebounceSettings } from 'lodash';\nimport debounce from 'lodash/debounce';\n\nexport const heavyDebounce = <T extends (...args: any) => any>(\n callback: T,\n ms = 500,\n option: DebounceSettings = {\n leading: true,\n trailing: true,\n },\n) => debounce(callback, ms, option);\n"]}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.lightThrottle = void 0;
|
|
7
|
-
|
|
8
|
-
var _throttle = _interopRequireDefault(require("lodash/throttle"));
|
|
9
|
-
|
|
10
|
-
var lightThrottle = function lightThrottle(callback) {
|
|
11
|
-
var ms = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 500;
|
|
12
|
-
var option = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {
|
|
13
|
-
leading: true,
|
|
14
|
-
trailing: true
|
|
15
|
-
};
|
|
16
|
-
return (0, _throttle["default"])(callback, ms, option);
|
|
17
|
-
};
|
|
18
|
-
|
|
19
|
-
exports.lightThrottle = lightThrottle;
|
|
20
|
-
//# sourceMappingURL=throttle.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["throttle.ts"],"names":["lightThrottle","callback","ms","option","leading","trailing"],"mappings":";;;;;;;AAEA;;AAEO,IAAMA,aAAa,GAAG,SAAhBA,aAAgB,CAC3BC,QAD2B;AAAA,MAE3BC,EAF2B,uEAEtB,GAFsB;AAAA,MAG3BC,MAH2B,uEAGA;AACzBC,IAAAA,OAAO,EAAE,IADgB;AAEzBC,IAAAA,QAAQ,EAAE;AAFe,GAHA;AAAA,SAOxB,0BAASJ,QAAT,EAAmBC,EAAnB,EAAuBC,MAAvB,CAPwB;AAAA,CAAtB","sourcesContent":["/* eslint-disable @typescript-eslint/no-explicit-any */\nimport type { ThrottleSettings } from 'lodash';\nimport throttle from 'lodash/throttle';\n\nexport const lightThrottle = <T extends (...args: any) => any>(\n callback: T,\n ms = 500,\n option: ThrottleSettings = {\n leading: true,\n trailing: true,\n },\n) => throttle(callback, ms, option);\n"]}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.heavyDebounce = void 0;
|
|
7
|
-
|
|
8
|
-
var _debounce = _interopRequireDefault(require("lodash/debounce"));
|
|
9
|
-
|
|
10
|
-
var heavyDebounce = function heavyDebounce(callback) {
|
|
11
|
-
var ms = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 500;
|
|
12
|
-
var option = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {
|
|
13
|
-
leading: true,
|
|
14
|
-
trailing: true
|
|
15
|
-
};
|
|
16
|
-
return (0, _debounce["default"])(callback, ms, option);
|
|
17
|
-
};
|
|
18
|
-
|
|
19
|
-
exports.heavyDebounce = heavyDebounce;
|
|
20
|
-
//# sourceMappingURL=debounce.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["debounce.ts"],"names":["heavyDebounce","callback","ms","option","leading","trailing"],"mappings":";;;;;;;AAEA;;AAEO,IAAMA,aAAa,GAAG,SAAhBA,aAAgB,CAC3BC,QAD2B;AAAA,MAE3BC,EAF2B,uEAEtB,GAFsB;AAAA,MAG3BC,MAH2B,uEAGA;AACzBC,IAAAA,OAAO,EAAE,IADgB;AAEzBC,IAAAA,QAAQ,EAAE;AAFe,GAHA;AAAA,SAOxB,0BAASJ,QAAT,EAAmBC,EAAnB,EAAuBC,MAAvB,CAPwB;AAAA,CAAtB","sourcesContent":["/* eslint-disable @typescript-eslint/no-explicit-any */\nimport type { DebounceSettings } from 'lodash';\nimport debounce from 'lodash/debounce';\n\nexport const heavyDebounce = <T extends (...args: any) => any>(\n callback: T,\n ms = 500,\n option: DebounceSettings = {\n leading: true,\n trailing: true,\n },\n) => debounce(callback, ms, option);\n"]}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.lightThrottle = void 0;
|
|
7
|
-
|
|
8
|
-
var _throttle = _interopRequireDefault(require("lodash/throttle"));
|
|
9
|
-
|
|
10
|
-
var lightThrottle = function lightThrottle(callback) {
|
|
11
|
-
var ms = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 500;
|
|
12
|
-
var option = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {
|
|
13
|
-
leading: true,
|
|
14
|
-
trailing: true
|
|
15
|
-
};
|
|
16
|
-
return (0, _throttle["default"])(callback, ms, option);
|
|
17
|
-
};
|
|
18
|
-
|
|
19
|
-
exports.lightThrottle = lightThrottle;
|
|
20
|
-
//# sourceMappingURL=throttle.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["throttle.ts"],"names":["lightThrottle","callback","ms","option","leading","trailing"],"mappings":";;;;;;;AAEA;;AAEO,IAAMA,aAAa,GAAG,SAAhBA,aAAgB,CAC3BC,QAD2B;AAAA,MAE3BC,EAF2B,uEAEtB,GAFsB;AAAA,MAG3BC,MAH2B,uEAGA;AACzBC,IAAAA,OAAO,EAAE,IADgB;AAEzBC,IAAAA,QAAQ,EAAE;AAFe,GAHA;AAAA,SAOxB,0BAASJ,QAAT,EAAmBC,EAAnB,EAAuBC,MAAvB,CAPwB;AAAA,CAAtB","sourcesContent":["/* eslint-disable @typescript-eslint/no-explicit-any */\nimport type { ThrottleSettings } from 'lodash';\nimport throttle from 'lodash/throttle';\n\nexport const lightThrottle = <T extends (...args: any) => any>(\n callback: T,\n ms = 500,\n option: ThrottleSettings = {\n leading: true,\n trailing: true,\n },\n) => throttle(callback, ms, option);\n"]}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
2
|
-
import type { DebounceSettings } from 'lodash';
|
|
3
|
-
import debounce from 'lodash/debounce';
|
|
4
|
-
|
|
5
|
-
export const heavyDebounce = <T extends (...args: any) => any>(
|
|
6
|
-
callback: T,
|
|
7
|
-
ms = 500,
|
|
8
|
-
option: DebounceSettings = {
|
|
9
|
-
leading: true,
|
|
10
|
-
trailing: true,
|
|
11
|
-
},
|
|
12
|
-
) => debounce(callback, ms, option);
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
2
|
-
import type { ThrottleSettings } from 'lodash';
|
|
3
|
-
import throttle from 'lodash/throttle';
|
|
4
|
-
|
|
5
|
-
export const lightThrottle = <T extends (...args: any) => any>(
|
|
6
|
-
callback: T,
|
|
7
|
-
ms = 500,
|
|
8
|
-
option: ThrottleSettings = {
|
|
9
|
-
leading: true,
|
|
10
|
-
trailing: true,
|
|
11
|
-
},
|
|
12
|
-
) => throttle(callback, ms, option);
|