rsuite 5.13.0 → 5.15.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/Button/styles/index.less +1 -0
- package/CHANGELOG.md +45 -0
- package/Dropdown/styles/index.less +8 -3
- package/Grid/styles/index.less +42 -10
- package/Sidenav/styles/index.less +45 -11
- package/Table/styles/index.less +0 -2
- package/Tooltip/styles/index.less +4 -4
- package/cjs/@types/common.d.ts +6 -0
- package/cjs/Cascader/utils.d.ts +1 -1
- package/cjs/Col/Col.d.ts +25 -5
- package/cjs/Col/Col.js +9 -1
- package/cjs/CustomProvider/CustomProvider.d.ts +20 -7
- package/cjs/CustomProvider/CustomProvider.js +24 -3
- package/cjs/Dropdown/useRenderDropdownItem.d.ts +1 -1
- package/cjs/Form/Form.d.ts +8 -8
- package/cjs/Form/test/Form.test.d.ts +1 -0
- package/cjs/Form/test/Form.test.js +18 -0
- package/cjs/Modal/test/Modal.test.d.ts +1 -0
- package/cjs/Modal/test/Modal.test.js +14 -0
- package/cjs/Modal/utils.d.ts +1 -1
- package/cjs/Nav/NavDropdownMenu.d.ts +12 -1
- package/cjs/Nav/NavDropdownMenu.js +9 -3
- package/cjs/Nav/test/Nav.test.d.ts +1 -0
- package/cjs/Nav/test/Nav.test.js +17 -0
- package/cjs/Navbar/NavbarDropdownMenu.d.ts +12 -1
- package/cjs/Navbar/NavbarDropdownMenu.js +9 -3
- package/cjs/Overlay/Modal.d.ts +1 -4
- package/cjs/Overlay/Overlay.d.ts +3 -1
- package/cjs/Overlay/Overlay.js +6 -2
- package/cjs/Overlay/OverlayTrigger.d.ts +8 -4
- package/cjs/Overlay/OverlayTrigger.js +32 -4
- package/cjs/Overlay/Position.d.ts +3 -1
- package/cjs/Overlay/Position.js +12 -4
- package/cjs/Overlay/positionUtils.d.ts +11 -4
- package/cjs/Overlay/positionUtils.js +48 -2
- package/cjs/Panel/Panel.js +9 -6
- package/cjs/Picker/utils.d.ts +1 -1
- package/cjs/Popover/Popover.d.ts +2 -0
- package/cjs/Popover/Popover.js +6 -3
- package/cjs/Sidenav/SidenavDropdownToggle.js +2 -1
- package/cjs/Sidenav/SidenavItem.d.ts +4 -0
- package/cjs/Sidenav/SidenavItem.js +40 -31
- package/cjs/Sidenav/SidenavToggle.d.ts +5 -1
- package/cjs/Sidenav/SidenavToggle.js +25 -9
- package/cjs/Toggle/Toggle.d.ts +1 -1
- package/cjs/Tooltip/Tooltip.d.ts +3 -1
- package/cjs/Tooltip/Tooltip.js +8 -3
- package/cjs/Whisper/Whisper.d.ts +3 -5
- package/cjs/Whisper/Whisper.js +6 -1
- package/cjs/Whisper/test/Whisper.test.d.ts +1 -0
- package/cjs/Whisper/test/Whisper.test.js +23 -0
- package/cjs/index.d.ts +3 -3
- package/cjs/index.js +3 -2
- package/cjs/toaster/ToastContainer.d.ts +1 -0
- package/cjs/toaster/ToastContainer.js +4 -1
- package/cjs/toaster/index.d.ts +1 -0
- package/cjs/toaster/index.js +4 -1
- package/cjs/toaster/toaster.d.ts +0 -1
- package/cjs/toaster/useToaster.d.ts +12 -0
- package/cjs/toaster/useToaster.js +43 -0
- package/cjs/utils/constants.d.ts +1 -0
- package/cjs/utils/constants.js +3 -1
- package/cjs/utils/stringToObject.d.ts +1 -1
- package/cjs/utils/tplTransform.d.ts +1 -1
- package/cjs/utils/treeUtils.d.ts +3 -3
- package/cjs/utils/treeUtils.js +8 -10
- package/cjs/utils/useCustom.d.ts +1 -1
- package/cjs/utils/useCustom.js +5 -3
- package/cjs/utils/useFocus.d.ts +1 -1
- package/dist/rsuite-rtl.css +741 -71
- package/dist/rsuite-rtl.min.css +1 -1
- package/dist/rsuite-rtl.min.css.map +1 -1
- package/dist/rsuite.css +741 -71
- package/dist/rsuite.js +92 -103
- package/dist/rsuite.js.map +1 -1
- package/dist/rsuite.min.css +1 -1
- package/dist/rsuite.min.css.map +1 -1
- package/dist/rsuite.min.js +1 -1
- package/dist/rsuite.min.js.map +1 -1
- package/esm/@types/common.d.ts +6 -0
- package/esm/Cascader/utils.d.ts +1 -1
- package/esm/Col/Col.d.ts +25 -5
- package/esm/Col/Col.js +10 -2
- package/esm/CustomProvider/CustomProvider.d.ts +20 -7
- package/esm/CustomProvider/CustomProvider.js +22 -3
- package/esm/Dropdown/useRenderDropdownItem.d.ts +1 -1
- package/esm/Form/Form.d.ts +8 -8
- package/esm/Form/test/Form.test.d.ts +1 -0
- package/esm/Form/test/Form.test.js +11 -0
- package/esm/Modal/test/Modal.test.d.ts +1 -0
- package/esm/Modal/test/Modal.test.js +9 -0
- package/esm/Modal/utils.d.ts +1 -1
- package/esm/Nav/NavDropdownMenu.d.ts +12 -1
- package/esm/Nav/NavDropdownMenu.js +8 -3
- package/esm/Nav/test/Nav.test.d.ts +1 -0
- package/esm/Nav/test/Nav.test.js +11 -0
- package/esm/Navbar/NavbarDropdownMenu.d.ts +12 -1
- package/esm/Navbar/NavbarDropdownMenu.js +8 -3
- package/esm/Overlay/Modal.d.ts +1 -4
- package/esm/Overlay/Overlay.d.ts +3 -1
- package/esm/Overlay/Overlay.js +6 -2
- package/esm/Overlay/OverlayTrigger.d.ts +8 -4
- package/esm/Overlay/OverlayTrigger.js +33 -5
- package/esm/Overlay/Position.d.ts +3 -1
- package/esm/Overlay/Position.js +12 -4
- package/esm/Overlay/positionUtils.d.ts +11 -4
- package/esm/Overlay/positionUtils.js +46 -2
- package/esm/Panel/Panel.js +9 -6
- package/esm/Picker/utils.d.ts +1 -1
- package/esm/Popover/Popover.d.ts +2 -0
- package/esm/Popover/Popover.js +6 -3
- package/esm/Sidenav/SidenavDropdownToggle.js +2 -1
- package/esm/Sidenav/SidenavItem.d.ts +4 -0
- package/esm/Sidenav/SidenavItem.js +38 -31
- package/esm/Sidenav/SidenavToggle.d.ts +5 -1
- package/esm/Sidenav/SidenavToggle.js +22 -9
- package/esm/Toggle/Toggle.d.ts +1 -1
- package/esm/Tooltip/Tooltip.d.ts +3 -1
- package/esm/Tooltip/Tooltip.js +8 -3
- package/esm/Whisper/Whisper.d.ts +3 -5
- package/esm/Whisper/Whisper.js +6 -1
- package/esm/Whisper/test/Whisper.test.d.ts +1 -0
- package/esm/Whisper/test/Whisper.test.js +16 -0
- package/esm/index.d.ts +3 -3
- package/esm/index.js +1 -1
- package/esm/toaster/ToastContainer.d.ts +1 -0
- package/esm/toaster/ToastContainer.js +1 -0
- package/esm/toaster/index.d.ts +1 -0
- package/esm/toaster/index.js +1 -0
- package/esm/toaster/toaster.d.ts +0 -1
- package/esm/toaster/useToaster.d.ts +12 -0
- package/esm/toaster/useToaster.js +34 -0
- package/esm/utils/constants.d.ts +1 -0
- package/esm/utils/constants.js +1 -0
- package/esm/utils/stringToObject.d.ts +1 -1
- package/esm/utils/tplTransform.d.ts +1 -1
- package/esm/utils/treeUtils.d.ts +3 -3
- package/esm/utils/treeUtils.js +8 -10
- package/esm/utils/useCustom.d.ts +1 -1
- package/esm/utils/useCustom.js +5 -3
- package/esm/utils/useFocus.d.ts +1 -1
- package/package.json +1 -1
- package/styles/color-modes/dark.less +223 -181
- package/styles/color-modes/high-contrast.less +221 -179
- package/styles/color-modes/light.less +47 -5
- package/styles/colors/dark.less +91 -91
- package/styles/colors/high-contrast.less +91 -91
- package/styles/variables.less +35 -12
- package/styles/color-modes/common.less +0 -44
package/esm/Whisper/Whisper.js
CHANGED
|
@@ -36,6 +36,11 @@ Whisper.propTypes = {
|
|
|
36
36
|
/**
|
|
37
37
|
* Prevent floating element overflow
|
|
38
38
|
*/
|
|
39
|
-
preventOverflow: PropTypes.bool
|
|
39
|
+
preventOverflow: PropTypes.bool,
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* Whether enable speaker follow cursor
|
|
43
|
+
*/
|
|
44
|
+
followCursor: PropTypes.bool
|
|
40
45
|
};
|
|
41
46
|
export default Whisper;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
var _whisperRef$current, _whisperRef$current2, _whisperRef$current3, _whisperRef$current4, _whisperRef$current5;
|
|
2
|
+
|
|
3
|
+
import React from 'react';
|
|
4
|
+
import Whisper from '../Whisper';
|
|
5
|
+
var whisperRef = /*#__PURE__*/React.createRef();
|
|
6
|
+
|
|
7
|
+
/*#__PURE__*/
|
|
8
|
+
React.createElement(Whisper, {
|
|
9
|
+
ref: whisperRef,
|
|
10
|
+
speaker: /*#__PURE__*/React.createElement("div", null)
|
|
11
|
+
}, /*#__PURE__*/React.createElement("div", null));
|
|
12
|
+
(_whisperRef$current = whisperRef.current) === null || _whisperRef$current === void 0 ? void 0 : _whisperRef$current.open();
|
|
13
|
+
(_whisperRef$current2 = whisperRef.current) === null || _whisperRef$current2 === void 0 ? void 0 : _whisperRef$current2.open(300);
|
|
14
|
+
(_whisperRef$current3 = whisperRef.current) === null || _whisperRef$current3 === void 0 ? void 0 : _whisperRef$current3.close();
|
|
15
|
+
(_whisperRef$current4 = whisperRef.current) === null || _whisperRef$current4 === void 0 ? void 0 : _whisperRef$current4.close(300);
|
|
16
|
+
(_whisperRef$current5 = whisperRef.current) === null || _whisperRef$current5 === void 0 ? void 0 : _whisperRef$current5.updatePosition();
|
package/esm/index.d.ts
CHANGED
|
@@ -7,7 +7,7 @@ export type { ButtonToolbarProps } from './ButtonToolbar';
|
|
|
7
7
|
export { default as ButtonGroup } from './ButtonGroup';
|
|
8
8
|
export type { ButtonGroupProps } from './ButtonGroup';
|
|
9
9
|
export { default as Whisper } from './Whisper';
|
|
10
|
-
export type { WhisperProps } from './Whisper';
|
|
10
|
+
export type { WhisperProps, WhisperInstance } from './Whisper';
|
|
11
11
|
export { default as Tooltip } from './Tooltip';
|
|
12
12
|
export type { TooltipProps } from './Tooltip';
|
|
13
13
|
export { default as Popover } from './Popover';
|
|
@@ -32,7 +32,7 @@ export { default as Avatar } from './Avatar';
|
|
|
32
32
|
export type { AvatarProps } from './Avatar';
|
|
33
33
|
export { default as AvatarGroup } from './AvatarGroup';
|
|
34
34
|
export type { AvatarGroupProps } from './AvatarGroup';
|
|
35
|
-
export { default as toaster } from './toaster';
|
|
35
|
+
export { default as toaster, useToaster } from './toaster';
|
|
36
36
|
export type { Toaster } from './toaster';
|
|
37
37
|
export { default as Dropdown } from './Dropdown';
|
|
38
38
|
export type { DropdownProps, DropdownMenuItemProps, DropdownMenuProps } from './Dropdown';
|
|
@@ -51,7 +51,7 @@ export type { StepsProps, StepItemProps } from './Steps';
|
|
|
51
51
|
export { default as Toggle } from './Toggle';
|
|
52
52
|
export type { ToggleProps } from './Toggle';
|
|
53
53
|
export { default as Form, useFormClassNames } from './Form';
|
|
54
|
-
export type { FormProps, FormGroupProps, FormErrorMessageProps, FormControlLabelProps, FormHelpTextProps, FormControlProps } from './Form';
|
|
54
|
+
export type { FormProps, FormInstance, FormGroupProps, FormErrorMessageProps, FormControlLabelProps, FormHelpTextProps, FormControlProps } from './Form';
|
|
55
55
|
export { default as Input } from './Input';
|
|
56
56
|
export type { InputProps } from './Input';
|
|
57
57
|
export { default as MaskedInput } from './MaskedInput';
|
package/esm/index.js
CHANGED
|
@@ -16,7 +16,7 @@ export { default as Placeholder } from './Placeholder';
|
|
|
16
16
|
export { default as Badge } from './Badge';
|
|
17
17
|
export { default as Avatar } from './Avatar';
|
|
18
18
|
export { default as AvatarGroup } from './AvatarGroup';
|
|
19
|
-
export { default as toaster } from './toaster';
|
|
19
|
+
export { default as toaster, useToaster } from './toaster';
|
|
20
20
|
// Nav
|
|
21
21
|
export { default as Dropdown } from './Dropdown';
|
|
22
22
|
export { default as Nav } from './Nav';
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { WithAsProps, RsRefForwardingComponent } from '../@types/common';
|
|
3
3
|
export declare type PlacementType = 'topCenter' | 'bottomCenter' | 'topStart' | 'topEnd' | 'bottomStart' | 'bottomEnd';
|
|
4
|
+
export declare const toastPlacements: PlacementType[];
|
|
4
5
|
export interface ToastContainerProps extends WithAsProps {
|
|
5
6
|
/** The placement of the message box */
|
|
6
7
|
placement?: PlacementType;
|
|
@@ -6,6 +6,7 @@ import PropTypes from 'prop-types';
|
|
|
6
6
|
import kebabCase from 'lodash/kebabCase';
|
|
7
7
|
import Transition from '../Animation/Transition';
|
|
8
8
|
import { useClassNames, guid, createChainedFunction } from '../utils';
|
|
9
|
+
export var toastPlacements = ['topCenter', 'bottomCenter', 'topStart', 'topEnd', 'bottomStart', 'bottomEnd'];
|
|
9
10
|
|
|
10
11
|
var useMessages = function useMessages() {
|
|
11
12
|
var _useState = useState([]),
|
package/esm/toaster/index.d.ts
CHANGED
package/esm/toaster/index.js
CHANGED
package/esm/toaster/toaster.d.ts
CHANGED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { ToastContainerProps } from './ToastContainer';
|
|
3
|
+
/**
|
|
4
|
+
* Hook to use the toaster
|
|
5
|
+
* @returns toaster { push, remove, clear }
|
|
6
|
+
*/
|
|
7
|
+
declare const useToaster: () => {
|
|
8
|
+
push: (message: React.ReactNode, options?: ToastContainerProps) => string | undefined;
|
|
9
|
+
remove: (key: string) => void;
|
|
10
|
+
clear: () => void;
|
|
11
|
+
};
|
|
12
|
+
export default useToaster;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import toaster from './toaster';
|
|
2
|
+
import { useCustom } from '../utils';
|
|
3
|
+
/**
|
|
4
|
+
* Hook to use the toaster
|
|
5
|
+
* @returns toaster { push, remove, clear }
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
var useToaster = function useToaster() {
|
|
9
|
+
var _useCustom = useCustom(),
|
|
10
|
+
toasters = _useCustom.toasters;
|
|
11
|
+
|
|
12
|
+
return {
|
|
13
|
+
push: function push(message, options) {
|
|
14
|
+
var _toasters$current;
|
|
15
|
+
|
|
16
|
+
var customToaster = toasters === null || toasters === void 0 ? void 0 : (_toasters$current = toasters.current) === null || _toasters$current === void 0 ? void 0 : _toasters$current.get((options === null || options === void 0 ? void 0 : options.placement) || 'topCenter');
|
|
17
|
+
return customToaster ? customToaster.push(message) : toaster.push(message, options);
|
|
18
|
+
},
|
|
19
|
+
remove: function remove(key) {
|
|
20
|
+
toasters ? Array.from(toasters.current).forEach(function (_ref) {
|
|
21
|
+
var c = _ref[1];
|
|
22
|
+
return c === null || c === void 0 ? void 0 : c.remove(key);
|
|
23
|
+
}) : toaster.remove(key);
|
|
24
|
+
},
|
|
25
|
+
clear: function clear() {
|
|
26
|
+
toasters ? Array.from(toasters.current).forEach(function (_ref2) {
|
|
27
|
+
var c = _ref2[1];
|
|
28
|
+
return c === null || c === void 0 ? void 0 : c.clear();
|
|
29
|
+
}) : toaster.clear();
|
|
30
|
+
}
|
|
31
|
+
};
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
export default useToaster;
|
package/esm/utils/constants.d.ts
CHANGED
package/esm/utils/constants.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export var SIZE = ['lg', 'md', 'sm', 'xs'];
|
|
2
|
+
export var COLUMN_SIZE = ['xxl', 'xl', 'lg', 'md', 'sm', 'xs'];
|
|
2
3
|
export var STATUS = ['success', 'warning', 'error', 'info'];
|
|
3
4
|
export var COLOR = ['red', 'orange', 'yellow', 'green', 'cyan', 'blue', 'violet'];
|
|
4
5
|
export var PLACEMENT_4 = ['top', 'bottom', 'right', 'left'];
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
declare const _default: (value: any, labelKey?: string
|
|
1
|
+
declare const _default: (value: any, labelKey?: string, valueKey?: string) => object | null;
|
|
2
2
|
export default _default;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
declare const _default: (pattern: string, ...data: any[]) => React.ReactNode;
|
|
3
2
|
/**
|
|
4
3
|
* tplTransform('Show {0} data', <i>100</i>);
|
|
5
4
|
* output:
|
|
6
5
|
* Show <span><i>100</i></span> data
|
|
7
6
|
*/
|
|
7
|
+
declare const _default: (pattern: string, ...data: any[]) => React.ReactNode;
|
|
8
8
|
export default _default;
|
package/esm/utils/treeUtils.d.ts
CHANGED
|
@@ -70,7 +70,7 @@ export declare function filterNodesOfTree(data: any, check: any): TreeNodeType[]
|
|
|
70
70
|
* @param isSearching - component is in Searching
|
|
71
71
|
* @returns
|
|
72
72
|
*/
|
|
73
|
-
export declare const getFocusableItems: (filteredData: ItemDataType[], props: Required<Pick<PartialTreeProps, 'disabledItemValues' | 'valueKey' | 'childrenKey' | 'expandItemValues'>>, isSearching?: boolean
|
|
73
|
+
export declare const getFocusableItems: (filteredData: ItemDataType[], props: Required<Pick<PartialTreeProps, 'disabledItemValues' | 'valueKey' | 'childrenKey' | 'expandItemValues'>>, isSearching?: boolean) => TreeNodeType[];
|
|
74
74
|
/**
|
|
75
75
|
* return all focusable Item and active Element index
|
|
76
76
|
* @param focusItemValue
|
|
@@ -190,7 +190,7 @@ interface UnSerializeListProps {
|
|
|
190
190
|
export declare function useFlattenTreeData({ data, labelKey, valueKey, childrenKey, uncheckableItemValues, callback }: FlattenTreeDataProps): {
|
|
191
191
|
forceUpdate: () => void;
|
|
192
192
|
flattenNodes: TreeNodesType;
|
|
193
|
-
flattenTreeData: (treeData: TreeNodeType[], ref: string, parent?: TreeNodeType
|
|
193
|
+
flattenTreeData: (treeData: TreeNodeType[], ref: string, parent?: TreeNodeType, layer?: any) => never[] | undefined;
|
|
194
194
|
serializeListOnlyParent: (nodes: TreeNodesType, key: string) => (string | number)[];
|
|
195
195
|
unSerializeList: ({ nodes, key, value, cascade, uncheckableItemValues }: UnSerializeListProps) => void;
|
|
196
196
|
formatVirtualizedTreeData: (nodes: TreeNodesType, data: any[], expandItemValues: ItemDataType[], options: {
|
|
@@ -203,7 +203,7 @@ export declare function useFlattenTreeData({ data, labelKey, valueKey, childrenK
|
|
|
203
203
|
*/
|
|
204
204
|
export declare function useTreeNodeRefs(): {
|
|
205
205
|
treeNodesRefs: {};
|
|
206
|
-
saveTreeNodeRef: (ref: React.Ref<any>, refKey?: string
|
|
206
|
+
saveTreeNodeRef: (ref: React.Ref<any>, refKey?: string) => void;
|
|
207
207
|
};
|
|
208
208
|
interface TreeSearchProps {
|
|
209
209
|
labelKey: string;
|
package/esm/utils/treeUtils.js
CHANGED
|
@@ -686,11 +686,7 @@ export function useFlattenTreeData(_ref8) {
|
|
|
686
686
|
var forceUpdate = useCallback(function () {
|
|
687
687
|
dispatch(Object.create(null));
|
|
688
688
|
}, [dispatch]);
|
|
689
|
-
|
|
690
|
-
var _useRef = useRef({}),
|
|
691
|
-
_useRef$current = _useRef.current,
|
|
692
|
-
flattenNodes = _useRef$current === void 0 ? {} : _useRef$current;
|
|
693
|
-
|
|
689
|
+
var flattenNodes = useRef({});
|
|
694
690
|
var flattenTreeData = useCallback(function (treeData, ref, parent, layer) {
|
|
695
691
|
if (layer === void 0) {
|
|
696
692
|
layer = 1;
|
|
@@ -705,20 +701,20 @@ export function useFlattenTreeData(_ref8) {
|
|
|
705
701
|
|
|
706
702
|
var refKey = ref + "-" + index;
|
|
707
703
|
node.refKey = refKey;
|
|
708
|
-
flattenNodes[refKey] = _extends((_extends2 = {
|
|
704
|
+
flattenNodes.current[refKey] = _extends((_extends2 = {
|
|
709
705
|
layer: layer
|
|
710
706
|
}, _extends2[labelKey] = node[labelKey], _extends2[valueKey] = node[valueKey], _extends2.uncheckable = uncheckableItemValues.some(function (value) {
|
|
711
707
|
return shallowEqual(node[valueKey], value);
|
|
712
708
|
}), _extends2), node);
|
|
713
709
|
|
|
714
710
|
if (parent) {
|
|
715
|
-
flattenNodes[refKey].parent = _omit(parent, 'parent', 'children');
|
|
711
|
+
flattenNodes.current[refKey].parent = _omit(parent, 'parent', 'children');
|
|
716
712
|
}
|
|
717
713
|
|
|
718
714
|
flattenTreeData(node[childrenKey], refKey, node, layer + 1);
|
|
719
715
|
});
|
|
720
|
-
callback === null || callback === void 0 ? void 0 : callback(flattenNodes);
|
|
721
|
-
}, [childrenKey, valueKey, labelKey, callback, uncheckableItemValues
|
|
716
|
+
callback === null || callback === void 0 ? void 0 : callback(flattenNodes.current);
|
|
717
|
+
}, [childrenKey, valueKey, labelKey, callback, uncheckableItemValues]);
|
|
722
718
|
var serializeListOnlyParent = useCallback(function (nodes, key) {
|
|
723
719
|
var list = [];
|
|
724
720
|
Object.keys(nodes).forEach(function (refKey) {
|
|
@@ -819,12 +815,14 @@ export function useFlattenTreeData(_ref8) {
|
|
|
819
815
|
};
|
|
820
816
|
|
|
821
817
|
useEffect(function () {
|
|
818
|
+
// when data is changed, should clear the flattenNodes, avoid duplicate keys
|
|
819
|
+
flattenNodes.current = {};
|
|
822
820
|
flattenTreeData(data, '0');
|
|
823
821
|
}, [data]); // eslint-disable-line react-hooks/exhaustive-deps
|
|
824
822
|
|
|
825
823
|
return {
|
|
826
824
|
forceUpdate: forceUpdate,
|
|
827
|
-
flattenNodes: flattenNodes,
|
|
825
|
+
flattenNodes: flattenNodes.current,
|
|
828
826
|
flattenTreeData: flattenTreeData,
|
|
829
827
|
serializeListOnlyParent: serializeListOnlyParent,
|
|
830
828
|
unSerializeList: unSerializeList,
|
package/esm/utils/useCustom.d.ts
CHANGED
|
@@ -3,5 +3,5 @@ import { CustomValue } from '../CustomProvider/CustomProvider';
|
|
|
3
3
|
* A hook to get custom configuration of `<CustomProvider>`
|
|
4
4
|
* @param keys
|
|
5
5
|
*/
|
|
6
|
-
declare function useCustom<T = any>(keys
|
|
6
|
+
declare function useCustom<T = any>(keys?: string | string[], overrideLocale?: any): CustomValue<T>;
|
|
7
7
|
export default useCustom;
|
package/esm/utils/useCustom.js
CHANGED
|
@@ -29,11 +29,12 @@ function useCustom(keys, overrideLocale) {
|
|
|
29
29
|
_useContext$rtl = _useContext.rtl,
|
|
30
30
|
rtl = _useContext$rtl === void 0 ? getDefaultRTL() : _useContext$rtl,
|
|
31
31
|
formatDate = _useContext.formatDate,
|
|
32
|
-
parseDate = _useContext.parseDate
|
|
32
|
+
parseDate = _useContext.parseDate,
|
|
33
|
+
toasters = _useContext.toasters;
|
|
33
34
|
|
|
34
|
-
var componentLocale = _extends({}, locale === null || locale === void 0 ? void 0 : locale.common, typeof keys === 'string' ? locale === null || locale === void 0 ? void 0 : locale[keys] : mergeObject(keys.map(function (key) {
|
|
35
|
+
var componentLocale = _extends({}, locale === null || locale === void 0 ? void 0 : locale.common, typeof keys === 'string' ? locale === null || locale === void 0 ? void 0 : locale[keys] : typeof keys === 'object' ? mergeObject(keys.map(function (key) {
|
|
35
36
|
return locale === null || locale === void 0 ? void 0 : locale[key];
|
|
36
|
-
}))); // Component custom locale
|
|
37
|
+
})) : {}); // Component custom locale
|
|
37
38
|
|
|
38
39
|
|
|
39
40
|
if (overrideLocale) {
|
|
@@ -57,6 +58,7 @@ function useCustom(keys, overrideLocale) {
|
|
|
57
58
|
return {
|
|
58
59
|
locale: componentLocale,
|
|
59
60
|
rtl: rtl,
|
|
61
|
+
toasters: toasters,
|
|
60
62
|
formatDate: formatDate || defaultFormatDate,
|
|
61
63
|
parseDate: parseDate || defaultParseDate
|
|
62
64
|
};
|
package/esm/utils/useFocus.d.ts
CHANGED