@publishfx/publish-components 2.1.4 → 2.1.6
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.
|
@@ -37,17 +37,22 @@ const TimePickerSelect = (props)=>{
|
|
|
37
37
|
isAllSelected,
|
|
38
38
|
options
|
|
39
39
|
]);
|
|
40
|
+
const sortByTime = useCallback((values)=>[
|
|
41
|
+
...values
|
|
42
|
+
].sort((a, b)=>a.localeCompare(b)), []);
|
|
40
43
|
const handleChange = useCallback((newValue)=>{
|
|
41
44
|
const normalizedValue = Array.isArray(newValue) ? newValue : void 0 !== newValue ? [
|
|
42
45
|
newValue
|
|
43
46
|
] : [];
|
|
44
|
-
const
|
|
45
|
-
|
|
46
|
-
|
|
47
|
+
const sortedValue = sortByTime(normalizedValue);
|
|
48
|
+
const selectedOptions = options.filter((opt)=>sortedValue.includes(opt.value)).sort((a, b)=>a.value.localeCompare(b.value));
|
|
49
|
+
if (!isControlled) setInternalValue(sortedValue);
|
|
50
|
+
onChange?.(sortedValue, selectedOptions);
|
|
47
51
|
}, [
|
|
48
52
|
onChange,
|
|
49
53
|
isControlled,
|
|
50
|
-
options
|
|
54
|
+
options,
|
|
55
|
+
sortByTime
|
|
51
56
|
]);
|
|
52
57
|
const handleSelectAll = useCallback(()=>{
|
|
53
58
|
const enabledOptions = options.filter((opt)=>!opt.disabled);
|