تصفية من جانب الخادم
- A Coruña Airport (LCG)
- A.J. Eisenberg Airport (ODW)
- A.L. Mangham Jr. Regional Airport (OCH)
- A.P. Hill Army Airfield (APH)
- Aachen Merzbrück Airfield (AAH)
- Aalborg Airport (AAL)
- Aarhus Airport (AAR)
- Aasiaat Airport (JEG)
- Aba Hongyuan Airport (AHJ)
- Aba Tenna Dejazmach Yilma International Airport (DIR)
- Abadan Airport (ABD)
- Abaiang Airport (ABF)
- Abakan Airport (ABA)
- Abau Airport (ABW)
- Abbaye Airport (BGH)
- Abbotsford International Airport (YXX)
- Abbse Airport (EAB)
- Abdelhafid Boussouf Bou Chekif Airport (TID)
- Abdul Rachman Saleh Airport (MLG)
- Abeche Airport (AEH)
- Abeid Amani Karume International Airport (ZNZ)
- Abel Santamaria Airport (SNU)
- Abemama Atoll Airport (AEA)
- Abengourou Airport (OGO)
- Aberdeen International Airport (ABZ)
- Aberdeen Regional Airport (ABR)
- Abha Regional Airport (AHB)
- Abilene Regional Airport (ABI)
- Abingdon Downs Airport (ABG)
- Aboisso Airport (ABO)
- Abou-Deïa Airport (AOD)
- Abraham Lincoln Capital Airport (SPI)
- Abresso Airport (RSK)
- Abruzzo Airport (PSR)
- Abu Dhabi International Airport (AUH)
- Abu Musa Island Airport (AEU)
- Abu Rudeis Airport (AUE)
- Abu Simbel Airport (ABS)
- Acadiana Regional Airport (ARA)
- Acaricuara Airport (ARF)
<.combobox
id="airport-combobox"
class="combobox"
translation={%Corex.Combobox.Translation{placeholder: ~t"Search…", empty: ~t"No results"}}
items={@items}
filter={false}
on_input_value_change="filter_airports"
>
<:empty>No results</:empty>
<:trigger><.heroicon name="hero-chevron-down" /></:trigger>
<:clear_trigger><.heroicon name="hero-backspace" /></:clear_trigger>
</.combobox>
defmodule MyAppWeb.AirportComboboxLive do
use MyAppWeb, :live_view
defp all_rows do
[
%{value: "LHR", label: ~t"London Heathrow (LHR)"},
%{value: "CDG", label: ~t"Paris Charles de Gaulle (CDG)"},
%{value: "JFK", label: ~t"New York John F. Kennedy (JFK)"}
]
end
def mount(_params, _session, socket) do
{:ok, assign(socket, :items, Corex.List.new(all_rows()))}
end
def handle_event("filter_airports", %{"reason" => "clear-trigger"}, socket) do
{:noreply, assign(socket, :items, Corex.List.new(all_rows()))}
end
def handle_event("filter_airports", %{"reason" => "item-select"}, socket), do: {:noreply, socket}
def handle_event("filter_airports", %{"value" => value}, socket) when is_binary(value) do
q = value |> String.trim() |> String.downcase()
rows =
if q == "" do
all_rows()
else
Enum.filter(all_rows(), fn r -> String.contains?(String.downcase(r.label), q) end)
end
{:noreply, assign(socket, :items, Corex.List.new(rows))}
end
def handle_event("filter_airports", _, socket), do: {:noreply, socket}
def render(assigns) do
~H|
<.combobox
id="airport-combobox"
class="combobox"
translation={%Corex.Combobox.Translation{placeholder: ~t"Search…", empty: ~t"No results"}}
items={@items}
filter={false}
on_input_value_change="filter_airports"
>
<:empty>No results</:empty>
<:trigger><.heroicon name="hero-chevron-down" /></:trigger>
<:clear_trigger><.heroicon name="hero-backspace" /></:clear_trigger>
</.combobox>
|
end
end
تصفية مجمّعة من جانب الخادم
-
Istanbul
- Istanbul Airport (IST)
- Sabiha Gökçen International Airport (SAW)
-
London
- Gatwick Airport (LGW)
- Heathrow Airport (LHR)
- London Stansted Airport (STN)
-
New York
- John F. Kennedy International Airport (JFK)
- LaGuardia Airport (LGA)
-
Newark
- Newark Liberty International Airport (EWR)
-
Paris
- Paris Charles de Gaulle Airport (CDG)
- Paris-Orly Airport (ORY)
Istanbul
- Istanbul Airport (IST)
- Sabiha Gökçen International Airport (SAW)
London
- Gatwick Airport (LGW)
- Heathrow Airport (LHR)
- London Stansted Airport (STN)
New York
- John F. Kennedy International Airport (JFK)
- LaGuardia Airport (LGA)
Newark
- Newark Liberty International Airport (EWR)
Paris
- Paris Charles de Gaulle Airport (CDG)
- Paris-Orly Airport (ORY)
<.combobox
id="airport-combobox-grouped"
class="combobox"
translation={%Corex.Combobox.Translation{placeholder: ~t"Search…", empty: ~t"No results"}}
items={@items}
filter={false}
on_input_value_change="filter_airports_grouped"
>
<:empty>No results</:empty>
<:trigger><.heroicon name="hero-chevron-down" /></:trigger>
<:clear_trigger><.heroicon name="hero-backspace" /></:clear_trigger>
</.combobox>
defmodule MyAppWeb.AirportComboboxGroupedLive do
use MyAppWeb, :live_view
defp all_rows do
[
%{value: "LHR", label: ~t"London Heathrow (LHR)", group: "London"},
%{value: "LGW", label: ~t"London Gatwick (LGW)", group: "London"},
%{value: "STN", label: ~t"London Stansted (STN)", group: "London"},
%{value: "JFK", label: ~t"New York John F. Kennedy (JFK)", group: "New York"},
%{value: "LGA", label: ~t"New York LaGuardia (LGA)", group: "New York"},
%{value: "EWR", label: ~t"Newark Liberty (EWR)", group: "New York"},
%{value: "CDG", label: ~t"Paris Charles de Gaulle (CDG)", group: "Paris"},
%{value: "ORY", label: ~t"Paris Orly (ORY)", group: "Paris"},
%{value: "IST", label: ~t"Istanbul Airport (IST)", group: "Istanbul"},
%{value: "SAW", label: ~t"Istanbul Sabiha Gökçen (SAW)", group: "Istanbul"}
]
end
def mount(_params, _session, socket) do
{:ok, assign(socket, :items, Corex.List.new(all_rows()))}
end
def handle_event("filter_airports_grouped", %{"reason" => "clear-trigger"}, socket) do
{:noreply, assign(socket, :items, Corex.List.new(all_rows()))}
end
def handle_event("filter_airports_grouped", %{"reason" => "item-select"}, socket), do: {:noreply, socket}
def handle_event("filter_airports_grouped", %{"value" => value}, socket) when is_binary(value) do
q = value |> String.trim() |> String.downcase()
rows =
if q == "" do
all_rows()
else
Enum.filter(all_rows(), fn r -> String.contains?(String.downcase(r.label), q) end)
end
{:noreply, assign(socket, :items, Corex.List.new(rows))}
end
def handle_event("filter_airports_grouped", _, socket), do: {:noreply, socket}
def render(assigns) do
~H|
<.combobox
id="airport-combobox-grouped"
class="combobox"
translation={%Corex.Combobox.Translation{placeholder: ~t"Search…", empty: ~t"No results"}}
items={@items}
filter={false}
on_input_value_change="filter_airports_grouped"
>
<:empty>No results</:empty>
<:trigger><.heroicon name="hero-chevron-down" /></:trigger>
<:clear_trigger><.heroicon name="hero-backspace" /></:clear_trigger>
</.combobox>
|
end
end