Expose every Bulma variant as a choosable option, not just a curated few
Adds a shared bulma_variants.py (color/size option lists) and expands BULMA_*_CONTROLS in bulma_controls.py to cover each component's full modifier set: Bouton (colour incl. white/light/dark/black/text, light-shade toggle, size, rounded, outlined, inverted, static, loading, fullwidth), Titre (Bulma size is-1..is-6 independent of heading level, is-spaced), Jauge (size), Tableau (bordered/fullwidth/striped/hoverable/narrow, now toggleable instead of hardcoded), Onglets (alignment, boxed/toggle/toggle-rounded style, size, fullwidth), and every form field — champ_texte/email/mot_de_passe, zone_texte, liste_deroulante (colour, size, rounded, static). render_select.py/render_onglets.py/render_jauge.py now redirect the merged "class" from _visible_attrs to the actual Bulma sub-element (the .select wrapper, the .tabs div, the <progress> tag) instead of the outer positioning wrapper, since that's what needs to carry the modifier classes. Also fixed a real latent bug found while wiring this up: a checkbox control with default=True (e.g. Tableau's "Première ligne = en-tête") was never actually applied on a freshly created element — default_style_and_attributes unconditionally skipped ALL checkbox types at creation, so the panel showed it checked while the element itself had nothing set. Now a checkbox's default=True is frozen at creation like any other meaningful default; default=False (the common case) is unaffected. Verified end to end: every widget's variant controls save and render the right class tokens (spot-checked titre/tableau/onglets/champ_texte/liste_deroulante/jauge), full suite green (89 passed).
This commit is contained in:
+14
-11
@@ -9,7 +9,10 @@ from .controls.c_align import c_align
|
||||
from .controls.c_select import c_select
|
||||
from .control_groups.text_style_controls_extra import TEXT_STYLE_CONTROLS_EXTRA
|
||||
from .control_groups.data_binding_controls import DATA_BINDING_CONTROLS
|
||||
from .control_groups.bulma_controls import BULMA_BUTTON_CONTROLS
|
||||
from .control_groups.bulma_controls import (
|
||||
BULMA_BUTTON_CONTROLS, BULMA_TITLE_CONTROLS, BULMA_PROGRESS_CONTROLS,
|
||||
BULMA_TABLE_CONTROLS, BULMA_TABS_CONTROLS, BULMA_FIELD_CONTROLS,
|
||||
)
|
||||
from .font_options import FONT_OPTIONS
|
||||
from ..flow.constants import CONDITION_OPERATORS
|
||||
|
||||
@@ -40,7 +43,7 @@ WIDGETS = {
|
||||
c_textarea("content", "Texte — {{champ}} affiche la valeur de ce champ sur la ligne trouvée ci-dessous", "content", default="Titre", group="Contenu"),
|
||||
c_select("niveau", "Importance du titre", "attr:_niveau",
|
||||
[("1", "Très grand — titre principal"), ("2", "Grand"), ("3", "Moyen")], default="2", group="Contenu"),
|
||||
] + DATA_BINDING_CONTROLS + [
|
||||
] + DATA_BINDING_CONTROLS + BULMA_TITLE_CONTROLS + [
|
||||
c_slider("font-size", "Taille du texte", "style:font-size", min=14, max=80, default=32, group="Texte"),
|
||||
c_color("color", "Couleur du texte", "style:color", "#e8eaf0", group="Texte"),
|
||||
c_align("text-align", "Alignement", "style:text-align", default="left", group="Texte"),
|
||||
@@ -105,7 +108,7 @@ WIDGETS = {
|
||||
c_text("placeholder", "Texte indicatif", "attr:placeholder", placeholder="ex. Votre réponse", group="Contenu"),
|
||||
c_text("name", "Nom du champ", "attr:name", placeholder="ex. reponse1", group="Contenu"),
|
||||
c_checkbox("required", "Obligatoire", "attr:required", "required", "", group="Contenu"),
|
||||
],
|
||||
] + BULMA_FIELD_CONTROLS,
|
||||
},
|
||||
"champ_email": {
|
||||
"label": "Champ — email", "icon": "📧", "tag": "input", "has_content": False, "self_closing": True,
|
||||
@@ -114,7 +117,7 @@ WIDGETS = {
|
||||
c_text("placeholder", "Texte indicatif", "attr:placeholder", placeholder="ex. votre@email.com", default="votre@email.com", group="Contenu"),
|
||||
c_text("name", "Nom du champ", "attr:name", placeholder="ex. email", group="Contenu"),
|
||||
c_checkbox("required", "Obligatoire", "attr:required", "required", "", group="Contenu"),
|
||||
],
|
||||
] + BULMA_FIELD_CONTROLS,
|
||||
},
|
||||
"champ_mot_de_passe": {
|
||||
"label": "Champ — mot de passe", "icon": "🔒", "tag": "input", "has_content": False, "self_closing": True,
|
||||
@@ -123,7 +126,7 @@ WIDGETS = {
|
||||
c_text("placeholder", "Texte indicatif", "attr:placeholder", placeholder="ex. Mot de passe", group="Contenu"),
|
||||
c_text("name", "Nom du champ", "attr:name", placeholder="ex. mot_de_passe", group="Contenu"),
|
||||
c_checkbox("required", "Obligatoire", "attr:required", "required", "", group="Contenu"),
|
||||
],
|
||||
] + BULMA_FIELD_CONTROLS,
|
||||
},
|
||||
"case_a_cocher": {
|
||||
"label": "Case à cocher", "icon": "☑️", "tag": "input", "has_content": True, "special_render": "checkbox_label",
|
||||
@@ -154,7 +157,7 @@ WIDGETS = {
|
||||
c_text("placeholder", "Texte indicatif", "attr:placeholder", placeholder="ex. Votre message", group="Contenu"),
|
||||
c_text("name", "Nom du champ", "attr:name", placeholder="ex. message", group="Contenu"),
|
||||
c_checkbox("required", "Obligatoire", "attr:required", "required", "", group="Contenu"),
|
||||
],
|
||||
] + BULMA_FIELD_CONTROLS,
|
||||
},
|
||||
"liste_deroulante": {
|
||||
"label": "Liste déroulante", "icon": "🔽", "tag": "select", "has_content": True, "special_render": "select_options",
|
||||
@@ -163,7 +166,7 @@ WIDGETS = {
|
||||
c_textarea("content", "Options — une par ligne", "content", default="Option 1\nOption 2\nOption 3", group="Contenu"),
|
||||
c_text("name", "Nom du champ", "attr:name", placeholder="ex. choix", group="Contenu"),
|
||||
c_checkbox("required", "Obligatoire", "attr:required", "required", "", group="Contenu"),
|
||||
],
|
||||
] + BULMA_FIELD_CONTROLS,
|
||||
},
|
||||
"groupe_champs": {
|
||||
"label": "Groupe de champs", "icon": "🗃️", "tag": "fieldset", "has_content": True, "special_render": "fieldset_legend",
|
||||
@@ -195,13 +198,13 @@ WIDGETS = {
|
||||
"tableau": {
|
||||
"label": "Tableau", "icon": "🗂️", "tag": "table", "has_content": True, "special_render": "table",
|
||||
"w": 55, "h": 25, "default_content": "Colonne 1;Colonne 2\nValeur A;Valeur B",
|
||||
"fixed_attrs": {"class": "table is-bordered is-fullwidth"},
|
||||
"fixed_attrs": {"class": "table"},
|
||||
"controls": [
|
||||
c_textarea("content", "Contenu — une ligne par rangée, colonnes séparées par ;", "content",
|
||||
default="Colonne 1;Colonne 2\nValeur A;Valeur B", group="Contenu"),
|
||||
c_checkbox("header_row", "Première ligne = en-tête", "attr:_header_row", "1", "", default=True, group="Contenu"),
|
||||
c_color("color", "Couleur du texte", "style:color", "#e8eaf0", group="Texte"),
|
||||
],
|
||||
] + BULMA_TABLE_CONTROLS,
|
||||
},
|
||||
"conteneur": {
|
||||
"label": "Conteneur / décor", "icon": "⬛", "tag": "div", "has_content": True,
|
||||
@@ -283,7 +286,7 @@ WIDGETS = {
|
||||
c_slider("nom_taille", "Taille du texte du nom", "attr:_nom_taille", unit="", min=8, max=32, default=12, group="Apparence"),
|
||||
c_checkbox("nom_gras", "Nom en gras", "attr:_nom_gras", "1", "", default=False, group="Apparence"),
|
||||
c_checkbox("nom_italique", "Nom en italique", "attr:_nom_italique", "1", "", default=False, group="Apparence"),
|
||||
],
|
||||
] + BULMA_PROGRESS_CONTROLS,
|
||||
},
|
||||
"superposition": {
|
||||
# 3.4 (Confort) — overlay/modale réutilisable : couvre TOUJOURS tout
|
||||
@@ -310,6 +313,6 @@ WIDGETS = {
|
||||
# qui réutilise les routes existantes (element_rename, element_delete).
|
||||
"label": "Onglets", "icon": "🗂️", "tag": "div", "has_content": False, "special_render": "onglets",
|
||||
"w": 60, "h": 40, "default_content": "",
|
||||
"controls": [],
|
||||
"controls": BULMA_TABS_CONTROLS,
|
||||
},
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user