Skip to content

Commit

Permalink
Merge pull request #1 from lonsdaledm/ruben/class-names-for-form-fields
Browse files Browse the repository at this point in the history
  • Loading branch information
rgimen3z authored Jan 30, 2024
2 parents cec25c6 + b133cf5 commit a22db2e
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/python-fastui/fastui/json_schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -175,17 +175,20 @@ def json_schema_field_to_field(
initial=schema.get('default'),
description=schema.get('description'),
mode=schema.get('mode', 'checkbox'),
class_name=schema.get('className'),
)
elif field := special_string_field(schema, name, title, required, False):
return field
else:
return FormFieldInput(
name=name,
title=title,
placeholder=schema.get('placeholder'),
html_type=input_html_type(schema),
required=required,
initial=schema.get('default'),
description=schema.get('description'),
class_name=schema.get('className'),
)


Expand Down Expand Up @@ -235,6 +238,7 @@ def special_string_field(
multiple=multiple,
accept=schema.get('accept'),
description=schema.get('description'),
class_name=schema.get('className'),
)
elif enum := schema.get('enum'):
enum_labels = schema.get('enum_labels', {})
Expand All @@ -247,6 +251,7 @@ def special_string_field(
options=[SelectOption(value=v, label=enum_labels.get(v) or as_title(v)) for v in enum],
initial=schema.get('default'),
description=schema.get('description'),
class_name=schema.get('className'),
)
elif search_url := schema.get('search_url'):
return FormFieldSelectSearch(
Expand All @@ -258,6 +263,7 @@ def special_string_field(
multiple=multiple,
initial=schema.get('initial'),
description=schema.get('description'),
class_name=schema.get('className'),
)


Expand Down

0 comments on commit a22db2e

Please sign in to comment.