rsuite 5.6.0 → 5.6.3
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/CHANGELOG.md +18 -0
- package/README.md +3 -1
- package/cjs/@types/common.d.ts +4 -4
- package/cjs/Affix/Affix.js +0 -2
- package/cjs/Animation/Transition.d.ts +1 -1
- package/cjs/Animation/Transition.js +10 -4
- package/cjs/CheckTreePicker/CheckTreePicker.js +12 -5
- package/cjs/CheckTreePicker/utils.js +1 -1
- package/cjs/DatePicker/DatePicker.d.ts +2 -1
- package/cjs/DatePicker/DatePicker.js +4 -3
- package/cjs/DateRangePicker/DateRangePicker.d.ts +2 -2
- package/cjs/DateRangePicker/DateRangePicker.js +4 -3
- package/cjs/IconButton/IconButton.d.ts +5 -2
- package/cjs/IconButton/IconButton.js +2 -2
- package/cjs/IconButton/test/IconButton.test.d.ts +1 -0
- package/cjs/IconButton/test/IconButton.test.js +24 -0
- package/cjs/List/helper/AutoScroller.d.ts +2 -3
- package/cjs/List/helper/useManager.d.ts +2 -2
- package/cjs/List/helper/useSortHelper.js +23 -9
- package/cjs/List/helper/utils.d.ts +4 -3
- package/cjs/List/helper/utils.js +2 -2
- package/cjs/MaskedInput/conformToMask.js +1 -0
- package/cjs/MultiCascader/DropdownMenu.js +2 -1
- package/cjs/MultiCascader/utils.js +7 -7
- package/cjs/Overlay/Position.js +1 -2
- package/cjs/Pagination/PaginationGroup.js +3 -3
- package/cjs/Picker/SelectedElement.js +1 -1
- package/cjs/Picker/index.d.ts +2 -1
- package/cjs/TreePicker/TreePicker.js +1 -1
- package/cjs/Uploader/Uploader.js +5 -1
- package/cjs/toaster/toaster.d.ts +1 -1
- package/cjs/toaster/toaster.js +9 -3
- package/cjs/utils/treeUtils.js +6 -4
- package/cjs/utils/useTimeout.d.ts +2 -2
- package/cjs/utils/useTimeout.js +17 -8
- package/dist/rsuite.js +38 -357
- package/dist/rsuite.js.map +1 -1
- package/dist/rsuite.min.js +1 -1
- package/dist/rsuite.min.js.map +1 -1
- package/esm/@types/common.d.ts +4 -4
- package/esm/Affix/Affix.js +0 -2
- package/esm/Animation/Transition.d.ts +1 -1
- package/esm/Animation/Transition.js +10 -4
- package/esm/CheckTreePicker/CheckTreePicker.js +12 -5
- package/esm/CheckTreePicker/utils.js +1 -1
- package/esm/DatePicker/DatePicker.d.ts +2 -1
- package/esm/DatePicker/DatePicker.js +4 -3
- package/esm/DateRangePicker/DateRangePicker.d.ts +2 -2
- package/esm/DateRangePicker/DateRangePicker.js +4 -3
- package/esm/IconButton/IconButton.d.ts +5 -2
- package/esm/IconButton/IconButton.js +1 -1
- package/esm/IconButton/test/IconButton.test.d.ts +1 -0
- package/esm/IconButton/test/IconButton.test.js +18 -0
- package/esm/List/helper/AutoScroller.d.ts +2 -3
- package/esm/List/helper/useManager.d.ts +2 -2
- package/esm/List/helper/useSortHelper.js +23 -9
- package/esm/List/helper/utils.d.ts +4 -3
- package/esm/List/helper/utils.js +2 -2
- package/esm/MaskedInput/conformToMask.js +1 -0
- package/esm/MultiCascader/DropdownMenu.js +2 -1
- package/esm/MultiCascader/utils.js +7 -7
- package/esm/Overlay/Position.js +1 -2
- package/esm/Pagination/PaginationGroup.js +3 -3
- package/esm/Picker/SelectedElement.js +1 -1
- package/esm/Picker/index.d.ts +2 -1
- package/esm/TreePicker/TreePicker.js +1 -1
- package/esm/Uploader/Uploader.js +5 -1
- package/esm/toaster/toaster.d.ts +1 -1
- package/esm/toaster/toaster.js +9 -3
- package/esm/utils/treeUtils.js +6 -4
- package/esm/utils/useTimeout.d.ts +2 -2
- package/esm/utils/useTimeout.js +17 -8
- package/package.json +2 -2
package/esm/utils/useTimeout.js
CHANGED
|
@@ -4,32 +4,41 @@ import { useEffect, useRef, useCallback } from 'react';
|
|
|
4
4
|
* A timer hook
|
|
5
5
|
* @param fn Timer callback function
|
|
6
6
|
* @param ms Milliseconds of the timer
|
|
7
|
-
* @param
|
|
7
|
+
* @param enabled Whether to open the timer
|
|
8
8
|
*/
|
|
9
|
-
function useTimeout(fn, ms,
|
|
9
|
+
function useTimeout(fn, ms, enabled) {
|
|
10
10
|
if (ms === void 0) {
|
|
11
11
|
ms = 0;
|
|
12
12
|
}
|
|
13
13
|
|
|
14
|
-
if (
|
|
15
|
-
|
|
14
|
+
if (enabled === void 0) {
|
|
15
|
+
enabled = true;
|
|
16
16
|
}
|
|
17
17
|
|
|
18
18
|
var timeout = useRef();
|
|
19
|
+
var callback = useRef(fn);
|
|
19
20
|
var clear = useCallback(function () {
|
|
20
21
|
timeout.current && clearTimeout(timeout.current);
|
|
21
22
|
}, []);
|
|
22
23
|
var set = useCallback(function () {
|
|
23
|
-
|
|
24
|
+
timeout.current && clearTimeout(timeout.current);
|
|
25
|
+
|
|
26
|
+
if (enabled) {
|
|
24
27
|
timeout.current = setTimeout(function () {
|
|
25
|
-
|
|
28
|
+
var _callback$current;
|
|
29
|
+
|
|
30
|
+
(_callback$current = callback.current) === null || _callback$current === void 0 ? void 0 : _callback$current.call(callback);
|
|
26
31
|
}, ms);
|
|
27
32
|
}
|
|
28
|
-
}, [ms,
|
|
33
|
+
}, [ms, enabled]); // update ref when function changes
|
|
34
|
+
|
|
35
|
+
useEffect(function () {
|
|
36
|
+
callback.current = fn;
|
|
37
|
+
}, [fn]);
|
|
29
38
|
useEffect(function () {
|
|
30
39
|
set();
|
|
31
40
|
return clear;
|
|
32
|
-
}, [
|
|
41
|
+
}, [ms, enabled, set, clear]);
|
|
33
42
|
return {
|
|
34
43
|
clear: clear,
|
|
35
44
|
reset: set
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "rsuite",
|
|
3
|
-
"version": "5.6.
|
|
3
|
+
"version": "5.6.3",
|
|
4
4
|
"description": "A suite of react components",
|
|
5
5
|
"main": "cjs/index.js",
|
|
6
6
|
"module": "esm/index.js",
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
"lodash": "^4.17.11",
|
|
38
38
|
"prop-types": "^15.7.2",
|
|
39
39
|
"react-virtualized": "^9.22.3",
|
|
40
|
-
"rsuite-table": "^5.3.
|
|
40
|
+
"rsuite-table": "^5.3.5",
|
|
41
41
|
"schema-typed": "^2.0.2"
|
|
42
42
|
},
|
|
43
43
|
"peerDependencies": {
|