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/cjs/toaster/toaster.js
CHANGED
|
@@ -41,6 +41,8 @@ var toaster = function toaster(message) {
|
|
|
41
41
|
};
|
|
42
42
|
|
|
43
43
|
toaster.push = function (message, options) {
|
|
44
|
+
var _container$current;
|
|
45
|
+
|
|
44
46
|
if (options === void 0) {
|
|
45
47
|
options = {};
|
|
46
48
|
}
|
|
@@ -53,18 +55,22 @@ toaster.push = function (message, options) {
|
|
|
53
55
|
container = createContainer((_options$placement = options.placement) !== null && _options$placement !== void 0 ? _options$placement : '', options);
|
|
54
56
|
}
|
|
55
57
|
|
|
56
|
-
return container.current.push(message);
|
|
58
|
+
return (_container$current = container.current) === null || _container$current === void 0 ? void 0 : _container$current.push(message);
|
|
57
59
|
};
|
|
58
60
|
|
|
59
61
|
toaster.remove = function (key) {
|
|
60
62
|
containers.forEach(function (c) {
|
|
61
|
-
|
|
63
|
+
var _c$current;
|
|
64
|
+
|
|
65
|
+
return (_c$current = c.current) === null || _c$current === void 0 ? void 0 : _c$current.remove(key);
|
|
62
66
|
});
|
|
63
67
|
};
|
|
64
68
|
|
|
65
69
|
toaster.clear = function () {
|
|
66
70
|
containers.forEach(function (c) {
|
|
67
|
-
|
|
71
|
+
var _c$current2;
|
|
72
|
+
|
|
73
|
+
return (_c$current2 = c.current) === null || _c$current2 === void 0 ? void 0 : _c$current2.clear();
|
|
68
74
|
});
|
|
69
75
|
};
|
|
70
76
|
|
package/cjs/utils/treeUtils.js
CHANGED
|
@@ -165,11 +165,13 @@ function getNodeParentKeys(nodes, node, valueKey) {
|
|
|
165
165
|
var parentKeys = [];
|
|
166
166
|
|
|
167
167
|
var traverse = function traverse(node) {
|
|
168
|
-
|
|
169
|
-
|
|
168
|
+
var _node$parent;
|
|
169
|
+
|
|
170
|
+
if (node !== null && node !== void 0 && (_node$parent = node.parent) !== null && _node$parent !== void 0 && _node$parent.refKey) {
|
|
171
|
+
var _node$parent2;
|
|
170
172
|
|
|
171
173
|
traverse(nodes[node.parent.refKey]);
|
|
172
|
-
parentKeys.push(node === null || node === void 0 ? void 0 : (_node$
|
|
174
|
+
parentKeys.push(node === null || node === void 0 ? void 0 : (_node$parent2 = node.parent) === null || _node$parent2 === void 0 ? void 0 : _node$parent2[valueKey]);
|
|
173
175
|
}
|
|
174
176
|
};
|
|
175
177
|
|
|
@@ -718,7 +720,7 @@ function getChildrenByFlattenNodes(nodes, parent) {
|
|
|
718
720
|
return Object.values(nodes).filter(function (item) {
|
|
719
721
|
var _item$parent;
|
|
720
722
|
|
|
721
|
-
return (item === null || item === void 0 ? void 0 : (_item$parent = item.parent) === null || _item$parent === void 0 ? void 0 : _item$parent.refKey) === parent.refKey && !nodes[item.refKey].uncheckable;
|
|
723
|
+
return (item === null || item === void 0 ? void 0 : (_item$parent = item.parent) === null || _item$parent === void 0 ? void 0 : _item$parent.refKey) === parent.refKey && item.refKey && !nodes[item.refKey].uncheckable;
|
|
722
724
|
});
|
|
723
725
|
}
|
|
724
726
|
|
|
@@ -6,7 +6,7 @@ export interface UseTimeoutFnReturn {
|
|
|
6
6
|
* A timer hook
|
|
7
7
|
* @param fn Timer callback function
|
|
8
8
|
* @param ms Milliseconds of the timer
|
|
9
|
-
* @param
|
|
9
|
+
* @param enabled Whether to open the timer
|
|
10
10
|
*/
|
|
11
|
-
declare function useTimeout(fn: (() => void) | undefined, ms?: number,
|
|
11
|
+
declare function useTimeout(fn: (() => void) | undefined, ms?: number, enabled?: boolean): UseTimeoutFnReturn;
|
|
12
12
|
export default useTimeout;
|
package/cjs/utils/useTimeout.js
CHANGED
|
@@ -9,32 +9,41 @@ var _react = require("react");
|
|
|
9
9
|
* A timer hook
|
|
10
10
|
* @param fn Timer callback function
|
|
11
11
|
* @param ms Milliseconds of the timer
|
|
12
|
-
* @param
|
|
12
|
+
* @param enabled Whether to open the timer
|
|
13
13
|
*/
|
|
14
|
-
function useTimeout(fn, ms,
|
|
14
|
+
function useTimeout(fn, ms, enabled) {
|
|
15
15
|
if (ms === void 0) {
|
|
16
16
|
ms = 0;
|
|
17
17
|
}
|
|
18
18
|
|
|
19
|
-
if (
|
|
20
|
-
|
|
19
|
+
if (enabled === void 0) {
|
|
20
|
+
enabled = true;
|
|
21
21
|
}
|
|
22
22
|
|
|
23
23
|
var timeout = (0, _react.useRef)();
|
|
24
|
+
var callback = (0, _react.useRef)(fn);
|
|
24
25
|
var clear = (0, _react.useCallback)(function () {
|
|
25
26
|
timeout.current && clearTimeout(timeout.current);
|
|
26
27
|
}, []);
|
|
27
28
|
var set = (0, _react.useCallback)(function () {
|
|
28
|
-
|
|
29
|
+
timeout.current && clearTimeout(timeout.current);
|
|
30
|
+
|
|
31
|
+
if (enabled) {
|
|
29
32
|
timeout.current = setTimeout(function () {
|
|
30
|
-
|
|
33
|
+
var _callback$current;
|
|
34
|
+
|
|
35
|
+
(_callback$current = callback.current) === null || _callback$current === void 0 ? void 0 : _callback$current.call(callback);
|
|
31
36
|
}, ms);
|
|
32
37
|
}
|
|
33
|
-
}, [ms,
|
|
38
|
+
}, [ms, enabled]); // update ref when function changes
|
|
39
|
+
|
|
40
|
+
(0, _react.useEffect)(function () {
|
|
41
|
+
callback.current = fn;
|
|
42
|
+
}, [fn]);
|
|
34
43
|
(0, _react.useEffect)(function () {
|
|
35
44
|
set();
|
|
36
45
|
return clear;
|
|
37
|
-
}, [
|
|
46
|
+
}, [ms, enabled, set, clear]);
|
|
38
47
|
return {
|
|
39
48
|
clear: clear,
|
|
40
49
|
reset: set
|