feat: Add useShortValue prop to CommunityAutocompleteInput and related components for improved community input handling, allowing for shorter community values to be processed.
Publish Fast Tabler Docker image / build-and-push-fast (push) Successful in 1m50s
Publish Fast Tabler Docker image / build-and-push-fast (push) Successful in 1m50s
This commit is contained in:
@@ -9,6 +9,7 @@ function CommunityAutocompleteInput({
|
||||
className = 'form-control',
|
||||
onSelectMeta,
|
||||
maxSuggestions = 8,
|
||||
useShortValue = false, // если true, передавать только короткую часть community (120 вместо 65000:120)
|
||||
}) {
|
||||
const containerRef = useRef(null);
|
||||
const inputRef = useRef(null);
|
||||
@@ -38,7 +39,12 @@ function CommunityAutocompleteInput({
|
||||
}, []);
|
||||
|
||||
const selectItem = (item) => {
|
||||
onChange(item.value);
|
||||
// Если useShortValue=true, извлекаем только часть после двоеточия (если есть)
|
||||
let valueToSet = item.value;
|
||||
if (useShortValue && typeof item.value === 'string' && item.value.includes(':')) {
|
||||
valueToSet = item.value.split(':')[1] || item.value;
|
||||
}
|
||||
onChange(valueToSet);
|
||||
if (onSelectMeta) onSelectMeta(item);
|
||||
setOpen(false);
|
||||
setActiveIndex(-1);
|
||||
|
||||
Reference in New Issue
Block a user