Shared plumbing for the admin list pages (Projects / Tasks / Templates): column-visibility persistence, search-param coercion, the client-search haystack builder, and the Columns dropdown component.
Each list page keeps its own column roster and settings key; these helpers only own the mechanics so the three pages can't drift apart.
Summary
Functions
Coerces the search event payload to a binary. A forged search[x]=y
body arrives as a map — the query side would shrug it off, but
rendering a map back into the input's value would crash the LV.
The Columns dropdown: a focus-based daisyUI dropdown (closes when
focus leaves) with one checkbox per optional column, each pushing
toggle_column with its column key. options is the page's
{key, translated_label} roster; visible its current visible set.
Reads a page's visible-column set from settings. nil (never saved)
falls back to defaults; an empty string is a deliberate "all
optional columns hidden". Unknown names are dropped and order is
normalized to the optional roster.
Lowercased match target for the TableLocalSearch hook: the record's
primary fields plus every language's translated values for the same
fields — the same coverage as the server-side ilike search, so the
instant client filter and the authoritative server result agree.
Toggles one column in the visible set and persists the result (comma-joined, one settings row per page). Returns the new set.
Functions
Coerces the search event payload to a binary. A forged search[x]=y
body arrives as a map — the query side would shrug it off, but
rendering a map back into the input's value would crash the LV.
The Columns dropdown: a focus-based daisyUI dropdown (closes when
focus leaves) with one checkbox per optional column, each pushing
toggle_column with its column key. options is the page's
{key, translated_label} roster; visible its current visible set.
Attributes
options(:list) (required)visible(:list) (required)
Reads a page's visible-column set from settings. nil (never saved)
falls back to defaults; an empty string is a deliberate "all
optional columns hidden". Unknown names are dropped and order is
normalized to the optional roster.
Lowercased match target for the TableLocalSearch hook: the record's
primary fields plus every language's translated values for the same
fields — the same coverage as the server-side ilike search, so the
instant client filter and the authoritative server result agree.
fields are the translation-map keys (strings); each must also name
a schema field (e.g. ["name", "description"], ["title", "description"]).
Toggles one column in the visible set and persists the result (comma-joined, one settings row per page). Returns the new set.