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

This commit is contained in:
2025-12-24 15:15:43 +07:00
parent 9cdcd054e7
commit f4a6ceed08
4 changed files with 21 additions and 9 deletions
@@ -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);