feat(GatewayAutocomplete): improve gateway filtering logic to show full list when a gateway is selected, enhancing user experience
Publish Fast Tabler Docker image / build-and-push-fast (push) Successful in 3m36s
Publish Fast Tabler Docker image / build-and-push-fast (push) Successful in 3m36s
This commit is contained in:
@@ -344,8 +344,17 @@ function GatewayAutocomplete({ label, value, onChange, gateways = [], required =
|
|||||||
}, [value]);
|
}, [value]);
|
||||||
|
|
||||||
// Фильтруем gateways по введённому тексту
|
// Фильтруем gateways по введённому тексту
|
||||||
|
// ВАЖНО: когда в поле уже выбран gateway (inputValue === value),
|
||||||
|
// показываем ПОЛНЫЙ список, чтобы можно было сразу выбрать другой.
|
||||||
const filteredGateways = gateways.filter(gw => {
|
const filteredGateways = gateways.filter(gw => {
|
||||||
const search = inputValue.toLowerCase();
|
const raw = inputValue || '';
|
||||||
|
const search = raw.toLowerCase().trim();
|
||||||
|
|
||||||
|
// Пустой ввод или просто отображение выбранного значения -> полный список
|
||||||
|
if (!search || raw === value) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
gw.name.toLowerCase().includes(search) ||
|
gw.name.toLowerCase().includes(search) ||
|
||||||
(gw.ip && gw.ip.toLowerCase().includes(search)) ||
|
(gw.ip && gw.ip.toLowerCase().includes(search)) ||
|
||||||
|
|||||||
Reference in New Issue
Block a user