import html as html_lib from .visible_attrs import _visible_attrs from .apply_ctx import _apply_ctx from .style_string import _style_string from .attr_string import _attr_string from .auto_id import _auto_id def _render_select(el, meta, slug=None, children_map=None, ctx=None, parent_flex_direction=None): # Bulma stylise un elle-même n'aurait aucun # effet. Le wrapper porte donc l'id/positionnement habituel de # l'élément (comme tous les autres widgets), le # ni le wrapper de positionnement, donc on les redirige à la main. bulma_classes = outer_attrs.get("class", "") select_attrs = {k: v for k, v in outer_attrs.items() if k not in ("id", "class", "data-element-id", "data-anim-target")} wrapper_attrs = {k: v for k, v in outer_attrs.items() if k in ("id", "data-element-id", "data-anim-target")} style = _style_string(el, " display:flex;", parent_flex_direction) content = _apply_ctx(el.get("content") or "", ctx) options = [o.strip() for o in content.split("\n") if o.strip()] opts_html = "".join(f'' for o in options) select_html = f'' select_wrap_class = html_lib.escape(("select is-fullwidth " + bulma_classes).strip()) return f'
{select_html}
'