rsuite 5.83.0 → 5.83.1
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 +9 -0
- package/cjs/CustomProvider/useCustom.js +24 -7
- package/dist/rsuite.js +1 -1
- package/dist/rsuite.min.js +1 -1
- package/dist/rsuite.min.js.map +1 -1
- package/esm/CustomProvider/useCustom.js +24 -7
- package/package.json +1 -1
|
@@ -10,12 +10,29 @@ import { CustomContext } from "./CustomContext.js";
|
|
|
10
10
|
function getDefaultRTL() {
|
|
11
11
|
return typeof document !== 'undefined' && (document.body.getAttribute('dir') || document.dir) === 'rtl';
|
|
12
12
|
}
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Maps a component name to its corresponding locale key
|
|
16
|
+
* @param componentName - The name of the component
|
|
17
|
+
* @returns The locale key for the component
|
|
18
|
+
*/
|
|
19
|
+
function getComponentLocaleKey(componentName) {
|
|
20
|
+
// Define mappings for components that share locale keys
|
|
21
|
+
var localeKeyMappings = {
|
|
22
|
+
// All picker components use the Combobox locale
|
|
23
|
+
Cascader: 'Combobox',
|
|
24
|
+
CheckTreePicker: 'Combobox',
|
|
25
|
+
MultiCascader: 'Combobox',
|
|
26
|
+
SelectPicker: 'Combobox',
|
|
27
|
+
TreePicker: 'Combobox',
|
|
28
|
+
CheckPicker: 'Combobox',
|
|
29
|
+
// Time components use date components locales
|
|
30
|
+
TimePicker: 'DatePicker',
|
|
31
|
+
TimeRangePicker: 'DateRangePicker'
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
// Return the mapped locale key or the component name itself if no mapping exists
|
|
35
|
+
return localeKeyMappings[componentName] || componentName;
|
|
19
36
|
}
|
|
20
37
|
|
|
21
38
|
/**
|
|
@@ -63,7 +80,7 @@ export function useCustom(componentName, componentProps) {
|
|
|
63
80
|
//Memoize the global default props based on component name
|
|
64
81
|
var globalDefaultProps = ((_components$component = components[componentName]) === null || _components$component === void 0 ? void 0 : _components$component.defaultProps) || {};
|
|
65
82
|
var mergedProps = assign({}, globalDefaultProps, restProps);
|
|
66
|
-
var localeKey =
|
|
83
|
+
var localeKey = getComponentLocaleKey(componentName);
|
|
67
84
|
|
|
68
85
|
// If the default locale has the component name, then merge the locale.
|
|
69
86
|
if (Object.keys(enGB).includes(localeKey)) {
|